diff --git a/Src/CSharpier.FakeGenerators/SyntaxNodeComparerGenerator.cs b/Src/CSharpier.FakeGenerators/SyntaxNodeComparerGenerator.cs index fc6570a7f..1ec251322 100644 --- a/Src/CSharpier.FakeGenerators/SyntaxNodeComparerGenerator.cs +++ b/Src/CSharpier.FakeGenerators/SyntaxNodeComparerGenerator.cs @@ -232,8 +232,9 @@ private static void GenerateMethod(StringBuilder sourceBuilder, Type type) ); sourceBuilder.AppendLine($" if (result.IsInvalid) return result;"); + // Omit the last separator when comparing the original node with the formatted node, as it legitimately may be added or removed sourceBuilder.AppendLine( - $" result = this.CompareLists(originalNode.{propertyName}.GetSeparators().ToList(), formattedNode.{propertyName}.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span);" + $" result = this.CompareLists(originalNode.{propertyName}.GetSeparators().Take(originalNode.{propertyName}.Count() - 1).ToList(), formattedNode.{propertyName}.GetSeparators().Take(formattedNode.{propertyName}.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span);" ); sourceBuilder.AppendLine($" if (result.IsInvalid) return result;"); } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/AnonymousObjectCreationExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/AnonymousObjectCreationExpressions.test index 7cfb349d5..3f241e6c1 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/AnonymousObjectCreationExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/AnonymousObjectCreationExpressions.test @@ -6,7 +6,7 @@ public class ClassName { One = "One", Two = "Two", - ThreeThreeThree = "ThreeThreeThree" + ThreeThreeThree = "ThreeThreeThree", }; public dynamic Value = new { NoName }; diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArgumentLists.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArgumentLists.test index 63bbbbfc8..87d5746f2 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArgumentLists.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArgumentLists.test @@ -30,7 +30,7 @@ public class ClassName elementSelector: static o => new Entity { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, } ); @@ -38,12 +38,12 @@ public class ClassName keySelector: static o => new Entity { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, }, resultSelector: static o => new Entity { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, } ); } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArrayCreationExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArrayCreationExpressions.test index 8612227c8..7787fced2 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArrayCreationExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ArrayCreationExpressions.test @@ -17,6 +17,6 @@ class ClassName private static readonly char[] initializerIndents = new char[] { Path.DirectorySeparatorChar, - Path.AltDirectorySeparatorChar + Path.AltDirectorySeparatorChar, }; } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test index b9759894a..2ee8b5ca8 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/CollectionExpressions.test @@ -9,14 +9,14 @@ string[] c = "________________________", "________________________", "________________________", - "________________________" + "________________________", ]; int[][] d = [ [1, 2, 3], [4, 5, 6], - [7, 8, 9] + [7, 8, 9], ]; var a = new A { B = [1, 2, 3] }; @@ -33,7 +33,7 @@ items.AddRange( "which span multiple lines", "are added here", "and something bad", - "happens" + "happens", ] ); @@ -43,15 +43,15 @@ someObject = new SomeObject Property2 = [ LongValue________________________________________________, - LongValue________________________________________________ + LongValue________________________________________________, ], - Property3 = "three" + Property3 = "three", }; someValue = [ LongValue________________________________________________, - LongValue________________________________________________ + LongValue________________________________________________, ]; CallMethod(parameter1, parameterName: [1, 2]); @@ -61,7 +61,7 @@ CallMethod( parameterName: [ LongValue________________________________________________, - LongValue________________________________________________ + LongValue________________________________________________, ] ); @@ -116,7 +116,7 @@ class MyClass ArgConstants.NoInteractivity, ArgConstants.UseProgramMain, ArgConstants.NoHttps, - ArgConstants.Empty + ArgConstants.Empty, ], ]; @@ -138,7 +138,7 @@ class MyClass DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, - DayOfWeek.Saturday + DayOfWeek.Saturday, ]; } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.expected.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.expected.test index 8729cc5fb..32a295eaa 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.expected.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.expected.test @@ -17,5 +17,5 @@ public enum SubCode DoNotKeepLine, [ForceLine] - ForceLine + ForceLine, } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.test index 6c219625e..f3152a633 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarationComments.test @@ -14,5 +14,5 @@ public enum SubCode DoNotKeepLine, [ForceLine] - ForceLine + ForceLine, } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarations.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarations.test index 82a392f7b..523c00b39 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarations.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/EnumDeclarations.test @@ -2,12 +2,34 @@ enum AnEnum { One, Two, - Three + Three, } public enum E +{ + A, + B = A, + C = 2 + A, +} + +public enum EnumWithDirective { A, B = A, C = 2 + A +#if DEBUG + , + D = 4, +#endif +} + +public enum EnumWithDirective2 +{ + A, + B = A, + C = 2 + A, +#if DEBUG + D = 4, +#endif + E = 5, } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FieldDeclarations.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FieldDeclarations.test index b1dd0df5d..62d29695e 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FieldDeclarations.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FieldDeclarations.test @@ -20,7 +20,7 @@ public class ClassName ) { Property1 = 1, - Property2 = 2 + Property2 = 2, }; private LotsOfParametersToCauseBreaking ShortFieldName = new LotsOfParametersToCauseBreaking( @@ -44,7 +44,7 @@ public class ClassName Property2 = false, Property3 = false, Property4 = false, - Property5 = false + Property5 = false, }; // leading comments diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8.test index ff8462d1f..7f5379f7f 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8.test @@ -6,5 +6,5 @@ public class ClassName public enum MeetingLocation { Café, - Restaurant + Restaurant, } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8BOM.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8BOM.test index 0e622b6b7..4e824fe83 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8BOM.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/FileEncoding_UTF8BOM.test @@ -6,5 +6,5 @@ public enum MeetingLocation { Café, - Restaurant + Restaurant, } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitArrayCreationExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitArrayCreationExpressions.test index 8ca35c9c9..b279dad20 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitArrayCreationExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitArrayCreationExpressions.test @@ -5,7 +5,7 @@ class ClassName int[,] array = new[,] { { 1, 2 }, - { 3, 4 } + { 3, 4 }, }; private string[] SomeArray = new[] @@ -25,7 +25,7 @@ class ClassName { "someLongValue", "anotherLongValue", - "yetAnotherLongValue" + "yetAnotherLongValue", }; return TheArrayInHereShouldAlsoNotBreak( diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitElementAccesses.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitElementAccesses.test index 3cd5c8fa2..f45e36325 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitElementAccesses.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ImplicitElementAccesses.test @@ -5,6 +5,6 @@ class ClassName Dictionary dictionary = new Dictionary { [1] = "one", - [2] = "two_______________________" + [2] = "two_______________________", }; } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/InitializerExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/InitializerExpressions.test index cbe656ed2..bfd510ee8 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/InitializerExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/InitializerExpressions.test @@ -5,13 +5,13 @@ class ClassName int[] array = { "someLongValue_____________________________________", - "someLongValue_____________________________________" + "someLongValue_____________________________________", }; int[] array = new int[] { "someLongValue_____________________________________", - "someLongValue_____________________________________" + "someLongValue_____________________________________", }; public IList Value = new List { "one", "two" }; @@ -19,7 +19,7 @@ class ClassName Dictionary dictionary = new Dictionary { { 1, "one_________" }, - { 2, "two_________________" } + { 2, "two_________________" }, }; Dictionary dictionary = new Dictionary @@ -30,7 +30,7 @@ class ClassName { 3, "ifThisIsReallyLongItShouldntInsertAnExtraLineAboveIt_________________________________" - } + }, }; private int[,] arrayInitializerWithoutSize = @@ -39,20 +39,20 @@ class ClassName { longValue______________________________, longValue______________________________, - longValue______________________________ + longValue______________________________, }, { longValue______________________________, longValue______________________________, - longValue______________________________ - } + longValue______________________________, + }, }; void MethodName() { var x = new SomeClass { - Property1 = true + Property1 = true, // should indent }; @@ -62,7 +62,7 @@ class ClassName { One = true, Two = true, - Three = true + Three = true, }; var objectInitializerExpression = new SomeObject() @@ -70,7 +70,7 @@ class ClassName ShouldNotBreak = { SomeProperty = SomeValue }, ShouldBreak = { - SomeOtherProperty = SomeLongValue_______________________________________ + SomeOtherProperty = SomeLongValue_______________________________________, }, SomeList = new List() { @@ -80,17 +80,17 @@ class ClassName new() { SomeProperty = SomeOtherValue, - AnotherProperty = SomeThirdValue_______________________ - } - } + AnotherProperty = SomeThirdValue_______________________, + }, + }, }; var someObject = new SomeObject { SomeProperty = { - someOtherValue__________________________________________________________________ - } + someOtherValue__________________________________________________________________, + }, }; var collectionInitializerExpressions = new SomeObject @@ -99,7 +99,7 @@ class ClassName ThisIsAlsoACollection = { longerValueThatMakesItBreak______________________, - longerValueThatMakesItBreak______________________ + longerValueThatMakesItBreak______________________, }, }; @@ -110,36 +110,36 @@ class ClassName var nestedInitializer = new Thing { One = 1, - Two = new Thing { One = 1 } + Two = new Thing { One = 1 }, }; var nestedInitializer = new List() { new Thing() { One = 1 }, - new Thing() { One = 1 } + new Thing() { One = 1 }, }; var nestedInitializer = new Thing { One = 1, - Two = new() { One = 1 } + Two = new() { One = 1 }, }; var nestedInitializer = new List() { new() { One = 1 }, - new() { One = 1 } + new() { One = 1 }, }; var noBreak = new List { new Thing { One = 1 } }; var yesBreak = new List { - new Thing { One = 1, Two = 2 } + new Thing { One = 1, Two = 2 }, }; var yesBreak = new List { new Thing { One = 1 }, - Two = 2 + Two = 2, }; var listInitializer = new List { 1, 2, 3 }; @@ -147,23 +147,23 @@ class ClassName { { 1, "" }, { 2, "a" }, - { 3, "b" } + { 3, "b" }, }; int[,,] cube = { { { 111, 112 }, - { 121, 122 } + { 121, 122 }, }, { { 211, 212 }, - { 221, 222 } - } + { 221, 222 }, + }, }; int[][] jagged = { { 111 }, - { 121, 122 } + { 121, 122 }, }; var conditionalsAndInvocations = new List @@ -184,7 +184,7 @@ class ClassName someLongCondition___________________________________ && someLongCondition___________________________________ ? one - : two + : two, }; var someObject = new SomeObject @@ -192,10 +192,10 @@ class ClassName SomeArray = new SomeOtherObject[] { new SomeOtherObject { SomeProperty = 1 }, - new SomeOtherObject() + new SomeOtherObject(), } .CallMethod() - .CallMethod() + .CallMethod(), }; var result = SomeType @@ -207,10 +207,10 @@ class ClassName SomeArray = new SomeOtherObject { new SomeOtherObject { SomeProperty = 1 }, - new SomeOtherObject() + new SomeOtherObject(), } .CallMethod() - .CallMethod() + .CallMethod(), }; var someObject = new SomeObject @@ -218,8 +218,8 @@ class ClassName SomeArray = new SomeOtherObject[] { new SomeOtherObject { SomeProperty = 1 }, - new SomeOtherObject() - } + new SomeOtherObject(), + }, }; var someObject = new SomeObject @@ -227,10 +227,10 @@ class ClassName SomeArray = new SomeOtherObject[] { new SomeOtherObject_________________________________(), - new SomeOtherObject_________________________________() + new SomeOtherObject_________________________________(), } .CallMethod() - .CallMethod() + .CallMethod(), }; // Issue#1268 @@ -244,6 +244,6 @@ class ClassName private SomeObject someObject = new(someLongParameter___________________) { - SomeProperty = someLongValue____________________________ + SomeProperty = someLongValue____________________________, }; } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ListPatterns.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ListPatterns.test index 8a4b4e864..17779fac6 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ListPatterns.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ListPatterns.test @@ -6,7 +6,7 @@ var someValue = .., { RawKind: (int)SyntaxKind.SingleLineCommentTrivia }, { RawKind: (int)SyntaxKind.SingleLineCommentTrivia }, - { RawKind: (int)SyntaxKind.EndOfLineTrivia } + { RawKind: (int)SyntaxKind.EndOfLineTrivia }, ]; var someValue = someString is [var firstCharacter, .. var rest]; @@ -17,7 +17,7 @@ var someValue = var firstCharacter____________, var secondCharacter__________, var thirdCharacter, - .. var rest + .. var rest, ]; return list switch diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.expected.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.expected.test index 0fdcbbb01..44f2bb82e 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.expected.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.expected.test @@ -9,13 +9,13 @@ public class ClassRules private enum AlwaysLineBeforeEnum { One, - Two + Two, } private enum NoDoubleLines { One, - Two + Two, } private class AlwaysLineBeforeClass { } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.test index 525510d86..c986d8399 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberLines.test @@ -6,13 +6,13 @@ public class ClassRules private enum AlwaysLineBeforeEnum { One, - Two + Two, } private enum NoDoubleLines { One, - Two + Two, } private class AlwaysLineBeforeClass { } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ObjectCreationExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ObjectCreationExpressions.test index fa5a1509d..a9e5074d9 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ObjectCreationExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ObjectCreationExpressions.test @@ -6,7 +6,7 @@ public class ClassName public ClassName WithMediumInitializer = new ClassName { - Property_____________________________ = true + Property_____________________________ = true, }; public ClassName WithBigInitializer = new ClassName @@ -15,7 +15,7 @@ public class ClassName Property2 = false, Property3 = false, Property4 = false, - Property5 = false + Property5 = false, }; public ClassName TrailingComma = new ClassName_______________________ @@ -35,7 +35,7 @@ public class ClassName new ClassName("parameter1", "parameter2") { Property1 = true } ) { - Property1 = true + Property1 = true, }; public SomeGenericObject WithGenericLongEnoughToBreak = diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ParenthesizedLambdaExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ParenthesizedLambdaExpressions.test index 0713d6c54..9c45fe868 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ParenthesizedLambdaExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/ParenthesizedLambdaExpressions.test @@ -72,7 +72,7 @@ public class ClassName Handler = CommandHandler.Create(() => { doSomething(); - }) + }), }; CallSomeMethod( diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/PropertyDeclarations.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/PropertyDeclarations.test index 4dd25a8ab..97e51a18d 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/PropertyDeclarations.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/PropertyDeclarations.test @@ -100,6 +100,6 @@ public class ClassName Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid(), - Guid.NewGuid() + Guid.NewGuid(), }; } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/QueryExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/QueryExpressions.test index 3fdf9819e..c001abf2e 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/QueryExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/QueryExpressions.test @@ -20,7 +20,7 @@ class ClassName { One = c.One, Two = c.Two, - Three = C.Three + Three = C.Three, }; var whereQuery = from c in customers where c.Value == "true" select d; @@ -70,7 +70,7 @@ class ClassName select new { Country________________________ = g.Key, - CustCount____________________________ = g.Count() + CustCount____________________________ = g.Count(), }; var complexQuerySupportsNewLines = diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test index 57bd8bbc9..d3f286637 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SimpleLambdaExpressions.test @@ -26,27 +26,26 @@ public class ClassName this.Where(x => x.IsSomething).Select(static o => new Entity { o.Prop }); - this.Where(x => x.IsLongSomething______________________) - .Select(static o => new { o.Prop, }); + this.Where(x => x.IsLongSomething______________________).Select(static o => new { o.Prop }); this.Where(x => x.IsLongSomething______________________) - .Select(selector: static o => new { o.Prop, }); + .Select(selector: static o => new { o.Prop }); this.Where(x => x.IsLongSomething________________) - .Select(static o => new Entity { o.Prop, }); + .Select(static o => new Entity { o.Prop }); this.Where(x => x.IsSomeThing) .Select(selector: static o => new { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, }); this.Where(x => x.IsSomeThing) .Select(selector: static o => new Entity { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, }); this.Select_________________________________( @@ -66,7 +65,7 @@ public class ClassName this.Select_________________________________( selector: static longName__________________ => new { - Prop__________ = longName__________________ + Prop__________ = longName__________________, } ); @@ -76,7 +75,7 @@ public class ClassName LongArgument_______________________ ) { - Prop__________ = longName__________________ + Prop__________ = longName__________________, } ); @@ -102,7 +101,7 @@ public class ClassName ) { o.LongName_______________________, - o.LongName_______________________ + o.LongName_______________________, }); this.Where(t => diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SpreadElements.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SpreadElements.test index 302826ab9..b530ecae1 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SpreadElements.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SpreadElements.test @@ -5,7 +5,7 @@ int[] someOtherArray = [ .. value1________________________________, .. value2________________________________, - .. value3________________________________ + .. value3________________________________, ]; List> list = @@ -17,5 +17,5 @@ List> list = context.EntityDefinitions.TryGetValue(target, out var type) ? type.ClassName : null ) ) - .Where(kvp => kvp.Value != null) + .Where(kvp => kvp.Value != null), ]; diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions.test index 676fb2df4..a3fbc915f 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions.test @@ -8,7 +8,7 @@ class ClassName 2 => 200, 3 when false => 300, - _ => throw new global::System.Exception() + _ => throw new global::System.Exception(), }; return (GetState(), action, hasKey) switch @@ -22,7 +22,7 @@ class ClassName (DoorState.Locked, Action.Unlock, true) => DoorState.Closed, (var state, _, _) => state, (_, _, _) - => DoorState.LongStateShouldNotGetExtraLine________________________________________ + => DoorState.LongStateShouldNotGetExtraLine________________________________________, }; return someValue switch @@ -62,14 +62,14 @@ class ClassName { } otherSyntax => CallSomeMethod(otherSyntax), { SomeProperty: true } => "Just because this is long, don't break the pattern ", - _ => CallSomeMethod(someValue) + _ => CallSomeMethod(someValue), }; return someValue switch { - { IsParameter: true, } => noExtraLineAfterThis, - { IsParameter: someLongValue____________________________________________, } - => someOtherValue + { IsParameter: true } => noExtraLineAfterThis, + { IsParameter: someLongValue____________________________________________ } + => someOtherValue, }; return (original, updated) switch @@ -86,7 +86,7 @@ class ClassName TupleElementIndex: var ui } updatedField ) - => originalField.Type.Equals(updatedField.Type) + => originalField.Type.Equals(updatedField.Type), }; return someValue switch @@ -108,7 +108,7 @@ class ClassName (true, true) => someOtherValue, (false, false) or someCondition - => someValue_____________________________________________________ + => someValue_____________________________________________________, }; } } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions_Tabs.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions_Tabs.test index fbd2f8561..ab1922a2f 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions_Tabs.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/SwitchExpressions_Tabs.test @@ -8,7 +8,7 @@ class ClassName 2 => 200, 3 when false => 300, - _ => throw new global::System.Exception() + _ => throw new global::System.Exception(), }; return (GetState(), action, hasKey) switch @@ -22,7 +22,7 @@ class ClassName (DoorState.Locked, Action.Unlock, true) => DoorState.Closed, (var state, _, _) => state, (_, _, _) - => DoorState.LongStateShouldNotGetExtraLine________________________________________ + => DoorState.LongStateShouldNotGetExtraLine________________________________________, }; return someValue switch @@ -62,14 +62,14 @@ class ClassName { } otherSyntax => CallSomeMethod(otherSyntax), { SomeProperty: true } => "Just because this is long, don't break the pattern ", - _ => CallSomeMethod(someValue) + _ => CallSomeMethod(someValue), }; return someValue switch { - { IsParameter: true, } => noExtraLineAfterThis, - { IsParameter: someLongValue____________________________________________, } - => someOtherValue + { IsParameter: true } => noExtraLineAfterThis, + { IsParameter: someLongValue____________________________________________ } + => someOtherValue, }; return (original, updated) switch @@ -86,7 +86,7 @@ class ClassName TupleElementIndex: var ui } updatedField ) - => originalField.Type.Equals(updatedField.Type) + => originalField.Type.Equals(updatedField.Type), }; } } diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.expected.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.expected.test new file mode 100644 index 000000000..cc1481310 --- /dev/null +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.expected.test @@ -0,0 +1,146 @@ +int[] shortCollectionExpressionTrailingComma = [1, 2, 3, 4, 5, 6, 7, 8]; + +int[] shortCollectionExpressionNoTrailingComma = [1, 2, 3, 4, 5, 6, 7, 8]; + +int[][] longCollectionExpressionTrailingComma = +[ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], +]; + +int[][] longCollectionExpressionNoTrailingComma = +[ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], +]; + +public dynamic shortAnonymousObjectCreationExpressionTrailingComma = new { Property = true }; + +public dynamic shortAnonymousObjectCreationExpressionNoTrailingComma = new { Property = true }; + +public dynamic longAnonymousObjectCreationExpressionTrailingComma = new +{ + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree", +}; + +public dynamic longAnonymousObjectCreationExpressionNoTrailingComma = new +{ + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree", +}; + +int[] shortInitializerExpressionTrailingComma = { 1, 2 }; + +int[] shortInitializerExpressionNoTrailingComma = { 1, 2 }; + +string[] longInitializerExpressionTrailingComma = +{ + "someLongValue_____________________________________", + "someLongValue_____________________________________", +}; + +string[] longInitializerExpressionNoTrailingComma = +{ + "someLongValue_____________________________________", + "someLongValue_____________________________________", +}; + +int switchExpressionTrailingComma() +{ + return 1 switch + { + 1 => 100, + _ => throw new global::System.Exception(), + }; +} + +int switchExpressionNoTrailingComma() +{ + return 1 switch + { + 1 => 100, + _ => throw new global::System.Exception(), + }; +} + +object listPatternTrailingComma(object list) +{ + return list switch + { + [var elem] => elem * elem, + [] => 0, + [..] elems => elems.Sum(e => e + e), + }; +} + +object listPatternNoTrailingComma(object list) +{ + return list switch + { + [var elem] => elem * elem, + [] => 0, + [..] elems => elems.Sum(e => e + e), + }; +} + +public enum EnumDeclarationTrailingComma +{ + Foo = 1, +} + +public enum EnumDeclarationNoTrailingCommand +{ + Foo = 1, +} + +public enum EnumDeclarationWithDirective +{ + Foo = 1, +#if DEBUG + Bar = 2, +#endif + Abc = 3, +} + +public enum EnumDeclarationWithDirectiveBeforeBracket +{ + Foo = 1, +#if DEBUG + Bar = 2, +#endif +} + +public enum EnumDeclarationWithLeadingCommaInDirective +{ + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif + , + Abc = 3, +} + +public enum EnumDeclarationWithLeadingCommaInDirectiveBeforeBracket +{ + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif +} + +public enum EnumDeclarationWithLeadingCommaInDirectiveAndTrailingComma +{ + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif + , +} diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.test new file mode 100644 index 000000000..a9f33c476 --- /dev/null +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/TrailingComma.test @@ -0,0 +1,130 @@ +int[] shortCollectionExpressionTrailingComma = [1, 2, 3, 4, 5, 6, 7, 8,]; + +int[] shortCollectionExpressionNoTrailingComma = [1, 2, 3, 4, 5, 6, 7, 8]; + +int[][] longCollectionExpressionTrailingComma = +[ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], +]; + +int[][] longCollectionExpressionNoTrailingComma = +[ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] +]; + +public dynamic shortAnonymousObjectCreationExpressionTrailingComma = new { Property = true, }; + +public dynamic shortAnonymousObjectCreationExpressionNoTrailingComma = new { Property = true }; + +public dynamic longAnonymousObjectCreationExpressionTrailingComma = new +{ + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree", +}; + +public dynamic longAnonymousObjectCreationExpressionNoTrailingComma = new +{ + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree" +}; + +int[] shortInitializerExpressionTrailingComma = { 1, 2, }; + +int[] shortInitializerExpressionNoTrailingComma = { 1, 2 }; + +string[] longInitializerExpressionTrailingComma = +{ + "someLongValue_____________________________________", + "someLongValue_____________________________________", +}; + +string[] longInitializerExpressionNoTrailingComma = +{ + "someLongValue_____________________________________", + "someLongValue_____________________________________" +}; + +int switchExpressionTrailingComma() +{ + return 1 switch { 1 => 100, _ => throw new global::System.Exception(), }; +} + +int switchExpressionNoTrailingComma() +{ + return 1 switch + { + 1 => 100, + _ => throw new global::System.Exception() + }; +} + +object listPatternTrailingComma(object list) +{ + return list switch { [var elem] => elem * elem, [] => 0, [..] elems => elems.Sum(e => e + e), }; +} + +object listPatternNoTrailingComma(object list) +{ + return list switch + { + [var elem] => elem * elem, + [] => 0, + [..] elems => elems.Sum(e => e + e) + }; +} + +public enum EnumDeclarationTrailingComma { Foo = 1, } + +public enum EnumDeclarationNoTrailingCommand +{ + Foo = 1 +} + +public enum EnumDeclarationWithDirective { + Foo = 1, +#if DEBUG + Bar = 2, +#endif + Abc = 3, +} + +public enum EnumDeclarationWithDirectiveBeforeBracket { + Foo = 1, +#if DEBUG + Bar = 2, +#endif +} + +public enum EnumDeclarationWithLeadingCommaInDirective { + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif + , + Abc = 3 +} + +public enum EnumDeclarationWithLeadingCommaInDirectiveBeforeBracket { + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif +} + +public enum EnumDeclarationWithLeadingCommaInDirectiveAndTrailingComma +{ + Foo = 1 +#if DEBUG + , + Bar = 2 +#endif + , +} diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/WithExpressions.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/WithExpressions.test index bd87fa5c8..b24138c93 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/WithExpressions.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/WithExpressions.test @@ -8,7 +8,7 @@ class ClassName { Property = "Value", AnotherProperty = "Value", - YetAnother = "Value" + YetAnother = "Value", }; } } diff --git a/Src/CSharpier.Tests/SyntaxNodeComparerTests.cs b/Src/CSharpier.Tests/SyntaxNodeComparerTests.cs index 856e64ce4..a1cb6b69c 100644 --- a/Src/CSharpier.Tests/SyntaxNodeComparerTests.cs +++ b/Src/CSharpier.Tests/SyntaxNodeComparerTests.cs @@ -646,6 +646,219 @@ public void RawStringLiterals_Error_With_Adding_Indentation_When_There_Was_None( result.Should().NotBeEmpty(); } + [Test] + public void CollectionExpression_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + int[][] a = + [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ]; + """"; + var right = """" + int[][] a = + [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + ]; + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void CollectionExpression_Work_With_Removing_Trailing_Comma_When_There_Was_One() + { + var left = """" + int[] a = [1, 2, 3,]; + """"; + var right = """" + int[] a = [1, 2, 3]; + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void AnonymousObjectCreationExpression_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + public dynamic a = new + { + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree" + }; + """"; + var right = """" + public dynamic a = new + { + One = "One", + Two = "Two", + ThreeThreeThree = "ThreeThreeThree", + }; + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void AnonymousObjectCreationExpression_Work_With_Removing_Trailing_Comma_When_There_Was_One() + { + var left = """" + public dynamic a = new { Property = true, } + """"; + var right = """" + public dynamic a = new { Property = true } + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void InitializerExpression_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + string[] a = + { + "someLongValue_____________________________________", + "someLongValue_____________________________________" + }; + """"; + var right = """" + string[] a = + { + "someLongValue_____________________________________", + "someLongValue_____________________________________", + }; + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void InitializerExpression_Work_With_Removing_Trailing_Comma_When_There_Was_One() + { + var left = """" + int[] a = { 1, 2, }; + """"; + var right = """" + int[] a = { 1, 2 }; + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void SwitchExpression_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + int switchExpressionNoTrailingComma() + { + return 1 switch { 1 => 100, _ => throw new global::System.Exception() }; + } + """"; + var right = """" + int switchExpressionNoTrailingComma() + { + return 1 switch + { + 1 => 100, + _ => throw new global::System.Exception(), + }; + } + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void ListPattern_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + object listPatternTrailingComma(object list) + { + return list switch + { + [var elem] => elem * elem, + [] => 0, + [..] elems => elems.Sum(e => e + e) + }; + } + """"; + var right = """" + object listPatternTrailingComma(object list) + { + return list switch + { + [var elem] => elem * elem, + [] => 0, + [..] elems => elems.Sum(e => e + e), + }; + } + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void EnumDeclaration_Work_With_Adding_Trailing_Comma_When_There_Was_None() + { + var left = """" + public enum Enum + { + Foo = 1 + } + """"; + var right = """" + public enum Enum + { + Foo = 1, + } + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + + [Test] + public void EnumDeclaration_Work_Without_Removing_Trailing_Comma_When_There_Already_Was_One() + { + var left = """" + public enum Enum { Foo = 1, } + """"; + var right = """" + public enum Enum + { + Foo = 1, + } + """"; + + var result = CompareSource(left, right); + + result.Should().BeEmpty(); + } + private static void ResultShouldBe(string result, string be) { if (Environment.GetEnvironmentVariable("NormalizeLineEndings") != null) diff --git a/Src/CSharpier/SyntaxNodeComparer.generated.cs b/Src/CSharpier/SyntaxNodeComparer.generated.cs index d098d25ce..ddcd4b8f4 100644 --- a/Src/CSharpier/SyntaxNodeComparer.generated.cs +++ b/Src/CSharpier/SyntaxNodeComparer.generated.cs @@ -38,490 +38,488 @@ private CompareResult Compare( switch (originalNode) { - case AccessorDeclarationSyntax accessorDeclarationSyntax: - return this.CompareAccessorDeclarationSyntax(accessorDeclarationSyntax, formattedNode as AccessorDeclarationSyntax); - case AccessorListSyntax accessorListSyntax: - return this.CompareAccessorListSyntax(accessorListSyntax, formattedNode as AccessorListSyntax); - case AliasQualifiedNameSyntax aliasQualifiedNameSyntax: - return this.CompareAliasQualifiedNameSyntax(aliasQualifiedNameSyntax, formattedNode as AliasQualifiedNameSyntax); - case AnonymousMethodExpressionSyntax anonymousMethodExpressionSyntax: - return this.CompareAnonymousMethodExpressionSyntax(anonymousMethodExpressionSyntax, formattedNode as AnonymousMethodExpressionSyntax); - case AnonymousObjectCreationExpressionSyntax anonymousObjectCreationExpressionSyntax: - return this.CompareAnonymousObjectCreationExpressionSyntax(anonymousObjectCreationExpressionSyntax, formattedNode as AnonymousObjectCreationExpressionSyntax); - case AnonymousObjectMemberDeclaratorSyntax anonymousObjectMemberDeclaratorSyntax: - return this.CompareAnonymousObjectMemberDeclaratorSyntax(anonymousObjectMemberDeclaratorSyntax, formattedNode as AnonymousObjectMemberDeclaratorSyntax); - case ArgumentListSyntax argumentListSyntax: - return this.CompareArgumentListSyntax(argumentListSyntax, formattedNode as ArgumentListSyntax); - case ArgumentSyntax argumentSyntax: - return this.CompareArgumentSyntax(argumentSyntax, formattedNode as ArgumentSyntax); - case ArrayCreationExpressionSyntax arrayCreationExpressionSyntax: - return this.CompareArrayCreationExpressionSyntax(arrayCreationExpressionSyntax, formattedNode as ArrayCreationExpressionSyntax); - case ArrayRankSpecifierSyntax arrayRankSpecifierSyntax: - return this.CompareArrayRankSpecifierSyntax(arrayRankSpecifierSyntax, formattedNode as ArrayRankSpecifierSyntax); - case ArrayTypeSyntax arrayTypeSyntax: - return this.CompareArrayTypeSyntax(arrayTypeSyntax, formattedNode as ArrayTypeSyntax); - case ArrowExpressionClauseSyntax arrowExpressionClauseSyntax: - return this.CompareArrowExpressionClauseSyntax(arrowExpressionClauseSyntax, formattedNode as ArrowExpressionClauseSyntax); - case AssignmentExpressionSyntax assignmentExpressionSyntax: - return this.CompareAssignmentExpressionSyntax(assignmentExpressionSyntax, formattedNode as AssignmentExpressionSyntax); - case AttributeArgumentListSyntax attributeArgumentListSyntax: - return this.CompareAttributeArgumentListSyntax(attributeArgumentListSyntax, formattedNode as AttributeArgumentListSyntax); - case AttributeArgumentSyntax attributeArgumentSyntax: - return this.CompareAttributeArgumentSyntax(attributeArgumentSyntax, formattedNode as AttributeArgumentSyntax); - case AttributeListSyntax attributeListSyntax: - return this.CompareAttributeListSyntax(attributeListSyntax, formattedNode as AttributeListSyntax); - case AttributeSyntax attributeSyntax: - return this.CompareAttributeSyntax(attributeSyntax, formattedNode as AttributeSyntax); - case AttributeTargetSpecifierSyntax attributeTargetSpecifierSyntax: - return this.CompareAttributeTargetSpecifierSyntax(attributeTargetSpecifierSyntax, formattedNode as AttributeTargetSpecifierSyntax); - case AwaitExpressionSyntax awaitExpressionSyntax: - return this.CompareAwaitExpressionSyntax(awaitExpressionSyntax, formattedNode as AwaitExpressionSyntax); - case BadDirectiveTriviaSyntax badDirectiveTriviaSyntax: - return this.CompareBadDirectiveTriviaSyntax(badDirectiveTriviaSyntax, formattedNode as BadDirectiveTriviaSyntax); - case BaseExpressionSyntax baseExpressionSyntax: - return this.CompareBaseExpressionSyntax(baseExpressionSyntax, formattedNode as BaseExpressionSyntax); - case BaseListSyntax baseListSyntax: - return this.CompareBaseListSyntax(baseListSyntax, formattedNode as BaseListSyntax); - case BinaryExpressionSyntax binaryExpressionSyntax: - return this.CompareBinaryExpressionSyntax(binaryExpressionSyntax, formattedNode as BinaryExpressionSyntax); - case BinaryPatternSyntax binaryPatternSyntax: - return this.CompareBinaryPatternSyntax(binaryPatternSyntax, formattedNode as BinaryPatternSyntax); - case BlockSyntax blockSyntax: - return this.CompareBlockSyntax(blockSyntax, formattedNode as BlockSyntax); - case BracketedArgumentListSyntax bracketedArgumentListSyntax: - return this.CompareBracketedArgumentListSyntax(bracketedArgumentListSyntax, formattedNode as BracketedArgumentListSyntax); - case BracketedParameterListSyntax bracketedParameterListSyntax: - return this.CompareBracketedParameterListSyntax(bracketedParameterListSyntax, formattedNode as BracketedParameterListSyntax); - case BreakStatementSyntax breakStatementSyntax: - return this.CompareBreakStatementSyntax(breakStatementSyntax, formattedNode as BreakStatementSyntax); - case CasePatternSwitchLabelSyntax casePatternSwitchLabelSyntax: - return this.CompareCasePatternSwitchLabelSyntax(casePatternSwitchLabelSyntax, formattedNode as CasePatternSwitchLabelSyntax); - case CaseSwitchLabelSyntax caseSwitchLabelSyntax: - return this.CompareCaseSwitchLabelSyntax(caseSwitchLabelSyntax, formattedNode as CaseSwitchLabelSyntax); - case CastExpressionSyntax castExpressionSyntax: - return this.CompareCastExpressionSyntax(castExpressionSyntax, formattedNode as CastExpressionSyntax); - case CatchClauseSyntax catchClauseSyntax: - return this.CompareCatchClauseSyntax(catchClauseSyntax, formattedNode as CatchClauseSyntax); - case CatchDeclarationSyntax catchDeclarationSyntax: - return this.CompareCatchDeclarationSyntax(catchDeclarationSyntax, formattedNode as CatchDeclarationSyntax); - case CatchFilterClauseSyntax catchFilterClauseSyntax: - return this.CompareCatchFilterClauseSyntax(catchFilterClauseSyntax, formattedNode as CatchFilterClauseSyntax); - case CheckedExpressionSyntax checkedExpressionSyntax: - return this.CompareCheckedExpressionSyntax(checkedExpressionSyntax, formattedNode as CheckedExpressionSyntax); - case CheckedStatementSyntax checkedStatementSyntax: - return this.CompareCheckedStatementSyntax(checkedStatementSyntax, formattedNode as CheckedStatementSyntax); - case ClassDeclarationSyntax classDeclarationSyntax: - return this.CompareClassDeclarationSyntax(classDeclarationSyntax, formattedNode as ClassDeclarationSyntax); - case ClassOrStructConstraintSyntax classOrStructConstraintSyntax: - return this.CompareClassOrStructConstraintSyntax(classOrStructConstraintSyntax, formattedNode as ClassOrStructConstraintSyntax); - case CollectionExpressionSyntax collectionExpressionSyntax: - return this.CompareCollectionExpressionSyntax(collectionExpressionSyntax, formattedNode as CollectionExpressionSyntax); - case CompilationUnitSyntax compilationUnitSyntax: - return this.CompareCompilationUnitSyntax(compilationUnitSyntax, formattedNode as CompilationUnitSyntax); - case ConditionalAccessExpressionSyntax conditionalAccessExpressionSyntax: - return this.CompareConditionalAccessExpressionSyntax(conditionalAccessExpressionSyntax, formattedNode as ConditionalAccessExpressionSyntax); - case ConditionalExpressionSyntax conditionalExpressionSyntax: - return this.CompareConditionalExpressionSyntax(conditionalExpressionSyntax, formattedNode as ConditionalExpressionSyntax); - case ConstantPatternSyntax constantPatternSyntax: - return this.CompareConstantPatternSyntax(constantPatternSyntax, formattedNode as ConstantPatternSyntax); - case ConstructorConstraintSyntax constructorConstraintSyntax: - return this.CompareConstructorConstraintSyntax(constructorConstraintSyntax, formattedNode as ConstructorConstraintSyntax); - case ConstructorDeclarationSyntax constructorDeclarationSyntax: - return this.CompareConstructorDeclarationSyntax(constructorDeclarationSyntax, formattedNode as ConstructorDeclarationSyntax); - case ConstructorInitializerSyntax constructorInitializerSyntax: - return this.CompareConstructorInitializerSyntax(constructorInitializerSyntax, formattedNode as ConstructorInitializerSyntax); - case ContinueStatementSyntax continueStatementSyntax: - return this.CompareContinueStatementSyntax(continueStatementSyntax, formattedNode as ContinueStatementSyntax); - case ConversionOperatorDeclarationSyntax conversionOperatorDeclarationSyntax: - return this.CompareConversionOperatorDeclarationSyntax(conversionOperatorDeclarationSyntax, formattedNode as ConversionOperatorDeclarationSyntax); - case ConversionOperatorMemberCrefSyntax conversionOperatorMemberCrefSyntax: - return this.CompareConversionOperatorMemberCrefSyntax(conversionOperatorMemberCrefSyntax, formattedNode as ConversionOperatorMemberCrefSyntax); - case CrefBracketedParameterListSyntax crefBracketedParameterListSyntax: - return this.CompareCrefBracketedParameterListSyntax(crefBracketedParameterListSyntax, formattedNode as CrefBracketedParameterListSyntax); - case CrefParameterListSyntax crefParameterListSyntax: - return this.CompareCrefParameterListSyntax(crefParameterListSyntax, formattedNode as CrefParameterListSyntax); - case CrefParameterSyntax crefParameterSyntax: - return this.CompareCrefParameterSyntax(crefParameterSyntax, formattedNode as CrefParameterSyntax); - case DeclarationExpressionSyntax declarationExpressionSyntax: - return this.CompareDeclarationExpressionSyntax(declarationExpressionSyntax, formattedNode as DeclarationExpressionSyntax); - case DeclarationPatternSyntax declarationPatternSyntax: - return this.CompareDeclarationPatternSyntax(declarationPatternSyntax, formattedNode as DeclarationPatternSyntax); - case DefaultConstraintSyntax defaultConstraintSyntax: - return this.CompareDefaultConstraintSyntax(defaultConstraintSyntax, formattedNode as DefaultConstraintSyntax); - case DefaultExpressionSyntax defaultExpressionSyntax: - return this.CompareDefaultExpressionSyntax(defaultExpressionSyntax, formattedNode as DefaultExpressionSyntax); - case DefaultSwitchLabelSyntax defaultSwitchLabelSyntax: - return this.CompareDefaultSwitchLabelSyntax(defaultSwitchLabelSyntax, formattedNode as DefaultSwitchLabelSyntax); - case DefineDirectiveTriviaSyntax defineDirectiveTriviaSyntax: - return this.CompareDefineDirectiveTriviaSyntax(defineDirectiveTriviaSyntax, formattedNode as DefineDirectiveTriviaSyntax); - case DelegateDeclarationSyntax delegateDeclarationSyntax: - return this.CompareDelegateDeclarationSyntax(delegateDeclarationSyntax, formattedNode as DelegateDeclarationSyntax); - case DestructorDeclarationSyntax destructorDeclarationSyntax: - return this.CompareDestructorDeclarationSyntax(destructorDeclarationSyntax, formattedNode as DestructorDeclarationSyntax); - case DiscardDesignationSyntax discardDesignationSyntax: - return this.CompareDiscardDesignationSyntax(discardDesignationSyntax, formattedNode as DiscardDesignationSyntax); - case DiscardPatternSyntax discardPatternSyntax: - return this.CompareDiscardPatternSyntax(discardPatternSyntax, formattedNode as DiscardPatternSyntax); - case DocumentationCommentTriviaSyntax documentationCommentTriviaSyntax: - return this.CompareDocumentationCommentTriviaSyntax(documentationCommentTriviaSyntax, formattedNode as DocumentationCommentTriviaSyntax); - case DoStatementSyntax doStatementSyntax: - return this.CompareDoStatementSyntax(doStatementSyntax, formattedNode as DoStatementSyntax); - case ElementAccessExpressionSyntax elementAccessExpressionSyntax: - return this.CompareElementAccessExpressionSyntax(elementAccessExpressionSyntax, formattedNode as ElementAccessExpressionSyntax); - case ElementBindingExpressionSyntax elementBindingExpressionSyntax: - return this.CompareElementBindingExpressionSyntax(elementBindingExpressionSyntax, formattedNode as ElementBindingExpressionSyntax); - case ElifDirectiveTriviaSyntax elifDirectiveTriviaSyntax: - return this.CompareElifDirectiveTriviaSyntax(elifDirectiveTriviaSyntax, formattedNode as ElifDirectiveTriviaSyntax); - case ElseClauseSyntax elseClauseSyntax: - return this.CompareElseClauseSyntax(elseClauseSyntax, formattedNode as ElseClauseSyntax); - case ElseDirectiveTriviaSyntax elseDirectiveTriviaSyntax: - return this.CompareElseDirectiveTriviaSyntax(elseDirectiveTriviaSyntax, formattedNode as ElseDirectiveTriviaSyntax); - case EmptyStatementSyntax emptyStatementSyntax: - return this.CompareEmptyStatementSyntax(emptyStatementSyntax, formattedNode as EmptyStatementSyntax); - case EndIfDirectiveTriviaSyntax endIfDirectiveTriviaSyntax: - return this.CompareEndIfDirectiveTriviaSyntax(endIfDirectiveTriviaSyntax, formattedNode as EndIfDirectiveTriviaSyntax); - case EndRegionDirectiveTriviaSyntax endRegionDirectiveTriviaSyntax: - return this.CompareEndRegionDirectiveTriviaSyntax(endRegionDirectiveTriviaSyntax, formattedNode as EndRegionDirectiveTriviaSyntax); - case EnumDeclarationSyntax enumDeclarationSyntax: - return this.CompareEnumDeclarationSyntax(enumDeclarationSyntax, formattedNode as EnumDeclarationSyntax); - case EnumMemberDeclarationSyntax enumMemberDeclarationSyntax: - return this.CompareEnumMemberDeclarationSyntax(enumMemberDeclarationSyntax, formattedNode as EnumMemberDeclarationSyntax); - case EqualsValueClauseSyntax equalsValueClauseSyntax: - return this.CompareEqualsValueClauseSyntax(equalsValueClauseSyntax, formattedNode as EqualsValueClauseSyntax); - case ErrorDirectiveTriviaSyntax errorDirectiveTriviaSyntax: - return this.CompareErrorDirectiveTriviaSyntax(errorDirectiveTriviaSyntax, formattedNode as ErrorDirectiveTriviaSyntax); - case EventDeclarationSyntax eventDeclarationSyntax: - return this.CompareEventDeclarationSyntax(eventDeclarationSyntax, formattedNode as EventDeclarationSyntax); - case EventFieldDeclarationSyntax eventFieldDeclarationSyntax: - return this.CompareEventFieldDeclarationSyntax(eventFieldDeclarationSyntax, formattedNode as EventFieldDeclarationSyntax); - case ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifierSyntax: - return this.CompareExplicitInterfaceSpecifierSyntax(explicitInterfaceSpecifierSyntax, formattedNode as ExplicitInterfaceSpecifierSyntax); - case ExpressionColonSyntax expressionColonSyntax: - return this.CompareExpressionColonSyntax(expressionColonSyntax, formattedNode as ExpressionColonSyntax); - case ExpressionElementSyntax expressionElementSyntax: - return this.CompareExpressionElementSyntax(expressionElementSyntax, formattedNode as ExpressionElementSyntax); - case ExpressionStatementSyntax expressionStatementSyntax: - return this.CompareExpressionStatementSyntax(expressionStatementSyntax, formattedNode as ExpressionStatementSyntax); - case ExternAliasDirectiveSyntax externAliasDirectiveSyntax: - return this.CompareExternAliasDirectiveSyntax(externAliasDirectiveSyntax, formattedNode as ExternAliasDirectiveSyntax); - case FieldDeclarationSyntax fieldDeclarationSyntax: - return this.CompareFieldDeclarationSyntax(fieldDeclarationSyntax, formattedNode as FieldDeclarationSyntax); - case FileScopedNamespaceDeclarationSyntax fileScopedNamespaceDeclarationSyntax: - return this.CompareFileScopedNamespaceDeclarationSyntax(fileScopedNamespaceDeclarationSyntax, formattedNode as FileScopedNamespaceDeclarationSyntax); - case FinallyClauseSyntax finallyClauseSyntax: - return this.CompareFinallyClauseSyntax(finallyClauseSyntax, formattedNode as FinallyClauseSyntax); - case FixedStatementSyntax fixedStatementSyntax: - return this.CompareFixedStatementSyntax(fixedStatementSyntax, formattedNode as FixedStatementSyntax); - case ForEachStatementSyntax forEachStatementSyntax: - return this.CompareForEachStatementSyntax(forEachStatementSyntax, formattedNode as ForEachStatementSyntax); - case ForEachVariableStatementSyntax forEachVariableStatementSyntax: - return this.CompareForEachVariableStatementSyntax(forEachVariableStatementSyntax, formattedNode as ForEachVariableStatementSyntax); - case ForStatementSyntax forStatementSyntax: - return this.CompareForStatementSyntax(forStatementSyntax, formattedNode as ForStatementSyntax); - case FromClauseSyntax fromClauseSyntax: - return this.CompareFromClauseSyntax(fromClauseSyntax, formattedNode as FromClauseSyntax); - case FunctionPointerCallingConventionSyntax functionPointerCallingConventionSyntax: - return this.CompareFunctionPointerCallingConventionSyntax(functionPointerCallingConventionSyntax, formattedNode as FunctionPointerCallingConventionSyntax); - case FunctionPointerParameterListSyntax functionPointerParameterListSyntax: - return this.CompareFunctionPointerParameterListSyntax(functionPointerParameterListSyntax, formattedNode as FunctionPointerParameterListSyntax); - case FunctionPointerParameterSyntax functionPointerParameterSyntax: - return this.CompareFunctionPointerParameterSyntax(functionPointerParameterSyntax, formattedNode as FunctionPointerParameterSyntax); - case FunctionPointerTypeSyntax functionPointerTypeSyntax: - return this.CompareFunctionPointerTypeSyntax(functionPointerTypeSyntax, formattedNode as FunctionPointerTypeSyntax); - case FunctionPointerUnmanagedCallingConventionListSyntax functionPointerUnmanagedCallingConventionListSyntax: - return this.CompareFunctionPointerUnmanagedCallingConventionListSyntax(functionPointerUnmanagedCallingConventionListSyntax, formattedNode as FunctionPointerUnmanagedCallingConventionListSyntax); - case FunctionPointerUnmanagedCallingConventionSyntax functionPointerUnmanagedCallingConventionSyntax: - return this.CompareFunctionPointerUnmanagedCallingConventionSyntax(functionPointerUnmanagedCallingConventionSyntax, formattedNode as FunctionPointerUnmanagedCallingConventionSyntax); - case GenericNameSyntax genericNameSyntax: - return this.CompareGenericNameSyntax(genericNameSyntax, formattedNode as GenericNameSyntax); - case GlobalStatementSyntax globalStatementSyntax: - return this.CompareGlobalStatementSyntax(globalStatementSyntax, formattedNode as GlobalStatementSyntax); - case GotoStatementSyntax gotoStatementSyntax: - return this.CompareGotoStatementSyntax(gotoStatementSyntax, formattedNode as GotoStatementSyntax); - case GroupClauseSyntax groupClauseSyntax: - return this.CompareGroupClauseSyntax(groupClauseSyntax, formattedNode as GroupClauseSyntax); - case IdentifierNameSyntax identifierNameSyntax: - return this.CompareIdentifierNameSyntax(identifierNameSyntax, formattedNode as IdentifierNameSyntax); - case IfDirectiveTriviaSyntax ifDirectiveTriviaSyntax: - return this.CompareIfDirectiveTriviaSyntax(ifDirectiveTriviaSyntax, formattedNode as IfDirectiveTriviaSyntax); - case IfStatementSyntax ifStatementSyntax: - return this.CompareIfStatementSyntax(ifStatementSyntax, formattedNode as IfStatementSyntax); - case ImplicitArrayCreationExpressionSyntax implicitArrayCreationExpressionSyntax: - return this.CompareImplicitArrayCreationExpressionSyntax(implicitArrayCreationExpressionSyntax, formattedNode as ImplicitArrayCreationExpressionSyntax); - case ImplicitElementAccessSyntax implicitElementAccessSyntax: - return this.CompareImplicitElementAccessSyntax(implicitElementAccessSyntax, formattedNode as ImplicitElementAccessSyntax); - case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpressionSyntax: - return this.CompareImplicitObjectCreationExpressionSyntax(implicitObjectCreationExpressionSyntax, formattedNode as ImplicitObjectCreationExpressionSyntax); - case ImplicitStackAllocArrayCreationExpressionSyntax implicitStackAllocArrayCreationExpressionSyntax: - return this.CompareImplicitStackAllocArrayCreationExpressionSyntax(implicitStackAllocArrayCreationExpressionSyntax, formattedNode as ImplicitStackAllocArrayCreationExpressionSyntax); - case IncompleteMemberSyntax incompleteMemberSyntax: - return this.CompareIncompleteMemberSyntax(incompleteMemberSyntax, formattedNode as IncompleteMemberSyntax); - case IndexerDeclarationSyntax indexerDeclarationSyntax: - return this.CompareIndexerDeclarationSyntax(indexerDeclarationSyntax, formattedNode as IndexerDeclarationSyntax); - case IndexerMemberCrefSyntax indexerMemberCrefSyntax: - return this.CompareIndexerMemberCrefSyntax(indexerMemberCrefSyntax, formattedNode as IndexerMemberCrefSyntax); - case InitializerExpressionSyntax initializerExpressionSyntax: - return this.CompareInitializerExpressionSyntax(initializerExpressionSyntax, formattedNode as InitializerExpressionSyntax); - case InterfaceDeclarationSyntax interfaceDeclarationSyntax: - return this.CompareInterfaceDeclarationSyntax(interfaceDeclarationSyntax, formattedNode as InterfaceDeclarationSyntax); - case InterpolatedStringExpressionSyntax interpolatedStringExpressionSyntax: - return this.CompareInterpolatedStringExpressionSyntax(interpolatedStringExpressionSyntax, formattedNode as InterpolatedStringExpressionSyntax); - case InterpolatedStringTextSyntax interpolatedStringTextSyntax: - return this.CompareInterpolatedStringTextSyntax(interpolatedStringTextSyntax, formattedNode as InterpolatedStringTextSyntax); - case InterpolationAlignmentClauseSyntax interpolationAlignmentClauseSyntax: - return this.CompareInterpolationAlignmentClauseSyntax(interpolationAlignmentClauseSyntax, formattedNode as InterpolationAlignmentClauseSyntax); - case InterpolationFormatClauseSyntax interpolationFormatClauseSyntax: - return this.CompareInterpolationFormatClauseSyntax(interpolationFormatClauseSyntax, formattedNode as InterpolationFormatClauseSyntax); - case InterpolationSyntax interpolationSyntax: - return this.CompareInterpolationSyntax(interpolationSyntax, formattedNode as InterpolationSyntax); - case InvocationExpressionSyntax invocationExpressionSyntax: - return this.CompareInvocationExpressionSyntax(invocationExpressionSyntax, formattedNode as InvocationExpressionSyntax); - case IsPatternExpressionSyntax isPatternExpressionSyntax: - return this.CompareIsPatternExpressionSyntax(isPatternExpressionSyntax, formattedNode as IsPatternExpressionSyntax); - case JoinClauseSyntax joinClauseSyntax: - return this.CompareJoinClauseSyntax(joinClauseSyntax, formattedNode as JoinClauseSyntax); - case JoinIntoClauseSyntax joinIntoClauseSyntax: - return this.CompareJoinIntoClauseSyntax(joinIntoClauseSyntax, formattedNode as JoinIntoClauseSyntax); - case LabeledStatementSyntax labeledStatementSyntax: - return this.CompareLabeledStatementSyntax(labeledStatementSyntax, formattedNode as LabeledStatementSyntax); - case LetClauseSyntax letClauseSyntax: - return this.CompareLetClauseSyntax(letClauseSyntax, formattedNode as LetClauseSyntax); - case LineDirectivePositionSyntax lineDirectivePositionSyntax: - return this.CompareLineDirectivePositionSyntax(lineDirectivePositionSyntax, formattedNode as LineDirectivePositionSyntax); - case LineDirectiveTriviaSyntax lineDirectiveTriviaSyntax: - return this.CompareLineDirectiveTriviaSyntax(lineDirectiveTriviaSyntax, formattedNode as LineDirectiveTriviaSyntax); - case LineSpanDirectiveTriviaSyntax lineSpanDirectiveTriviaSyntax: - return this.CompareLineSpanDirectiveTriviaSyntax(lineSpanDirectiveTriviaSyntax, formattedNode as LineSpanDirectiveTriviaSyntax); - case ListPatternSyntax listPatternSyntax: - return this.CompareListPatternSyntax(listPatternSyntax, formattedNode as ListPatternSyntax); - case LiteralExpressionSyntax literalExpressionSyntax: - return this.CompareLiteralExpressionSyntax(literalExpressionSyntax, formattedNode as LiteralExpressionSyntax); - case LoadDirectiveTriviaSyntax loadDirectiveTriviaSyntax: - return this.CompareLoadDirectiveTriviaSyntax(loadDirectiveTriviaSyntax, formattedNode as LoadDirectiveTriviaSyntax); - case LocalDeclarationStatementSyntax localDeclarationStatementSyntax: - return this.CompareLocalDeclarationStatementSyntax(localDeclarationStatementSyntax, formattedNode as LocalDeclarationStatementSyntax); - case LocalFunctionStatementSyntax localFunctionStatementSyntax: - return this.CompareLocalFunctionStatementSyntax(localFunctionStatementSyntax, formattedNode as LocalFunctionStatementSyntax); - case LockStatementSyntax lockStatementSyntax: - return this.CompareLockStatementSyntax(lockStatementSyntax, formattedNode as LockStatementSyntax); - case MakeRefExpressionSyntax makeRefExpressionSyntax: - return this.CompareMakeRefExpressionSyntax(makeRefExpressionSyntax, formattedNode as MakeRefExpressionSyntax); - case MemberAccessExpressionSyntax memberAccessExpressionSyntax: - return this.CompareMemberAccessExpressionSyntax(memberAccessExpressionSyntax, formattedNode as MemberAccessExpressionSyntax); - case MemberBindingExpressionSyntax memberBindingExpressionSyntax: - return this.CompareMemberBindingExpressionSyntax(memberBindingExpressionSyntax, formattedNode as MemberBindingExpressionSyntax); - case MethodDeclarationSyntax methodDeclarationSyntax: - return this.CompareMethodDeclarationSyntax(methodDeclarationSyntax, formattedNode as MethodDeclarationSyntax); - case NameColonSyntax nameColonSyntax: - return this.CompareNameColonSyntax(nameColonSyntax, formattedNode as NameColonSyntax); - case NameEqualsSyntax nameEqualsSyntax: - return this.CompareNameEqualsSyntax(nameEqualsSyntax, formattedNode as NameEqualsSyntax); - case NameMemberCrefSyntax nameMemberCrefSyntax: - return this.CompareNameMemberCrefSyntax(nameMemberCrefSyntax, formattedNode as NameMemberCrefSyntax); - case NamespaceDeclarationSyntax namespaceDeclarationSyntax: - return this.CompareNamespaceDeclarationSyntax(namespaceDeclarationSyntax, formattedNode as NamespaceDeclarationSyntax); - case NullableDirectiveTriviaSyntax nullableDirectiveTriviaSyntax: - return this.CompareNullableDirectiveTriviaSyntax(nullableDirectiveTriviaSyntax, formattedNode as NullableDirectiveTriviaSyntax); - case NullableTypeSyntax nullableTypeSyntax: - return this.CompareNullableTypeSyntax(nullableTypeSyntax, formattedNode as NullableTypeSyntax); - case ObjectCreationExpressionSyntax objectCreationExpressionSyntax: - return this.CompareObjectCreationExpressionSyntax(objectCreationExpressionSyntax, formattedNode as ObjectCreationExpressionSyntax); - case OmittedArraySizeExpressionSyntax omittedArraySizeExpressionSyntax: - return this.CompareOmittedArraySizeExpressionSyntax(omittedArraySizeExpressionSyntax, formattedNode as OmittedArraySizeExpressionSyntax); - case OmittedTypeArgumentSyntax omittedTypeArgumentSyntax: - return this.CompareOmittedTypeArgumentSyntax(omittedTypeArgumentSyntax, formattedNode as OmittedTypeArgumentSyntax); - case OperatorDeclarationSyntax operatorDeclarationSyntax: - return this.CompareOperatorDeclarationSyntax(operatorDeclarationSyntax, formattedNode as OperatorDeclarationSyntax); - case OperatorMemberCrefSyntax operatorMemberCrefSyntax: - return this.CompareOperatorMemberCrefSyntax(operatorMemberCrefSyntax, formattedNode as OperatorMemberCrefSyntax); - case OrderByClauseSyntax orderByClauseSyntax: - return this.CompareOrderByClauseSyntax(orderByClauseSyntax, formattedNode as OrderByClauseSyntax); - case OrderingSyntax orderingSyntax: - return this.CompareOrderingSyntax(orderingSyntax, formattedNode as OrderingSyntax); - case ParameterListSyntax parameterListSyntax: - return this.CompareParameterListSyntax(parameterListSyntax, formattedNode as ParameterListSyntax); - case ParameterSyntax parameterSyntax: - return this.CompareParameterSyntax(parameterSyntax, formattedNode as ParameterSyntax); - case ParenthesizedExpressionSyntax parenthesizedExpressionSyntax: - return this.CompareParenthesizedExpressionSyntax(parenthesizedExpressionSyntax, formattedNode as ParenthesizedExpressionSyntax); - case ParenthesizedLambdaExpressionSyntax parenthesizedLambdaExpressionSyntax: - return this.CompareParenthesizedLambdaExpressionSyntax(parenthesizedLambdaExpressionSyntax, formattedNode as ParenthesizedLambdaExpressionSyntax); - case ParenthesizedPatternSyntax parenthesizedPatternSyntax: - return this.CompareParenthesizedPatternSyntax(parenthesizedPatternSyntax, formattedNode as ParenthesizedPatternSyntax); - case ParenthesizedVariableDesignationSyntax parenthesizedVariableDesignationSyntax: - return this.CompareParenthesizedVariableDesignationSyntax(parenthesizedVariableDesignationSyntax, formattedNode as ParenthesizedVariableDesignationSyntax); - case PointerTypeSyntax pointerTypeSyntax: - return this.ComparePointerTypeSyntax(pointerTypeSyntax, formattedNode as PointerTypeSyntax); - case PositionalPatternClauseSyntax positionalPatternClauseSyntax: - return this.ComparePositionalPatternClauseSyntax(positionalPatternClauseSyntax, formattedNode as PositionalPatternClauseSyntax); - case PostfixUnaryExpressionSyntax postfixUnaryExpressionSyntax: - return this.ComparePostfixUnaryExpressionSyntax(postfixUnaryExpressionSyntax, formattedNode as PostfixUnaryExpressionSyntax); - case PragmaChecksumDirectiveTriviaSyntax pragmaChecksumDirectiveTriviaSyntax: - return this.ComparePragmaChecksumDirectiveTriviaSyntax(pragmaChecksumDirectiveTriviaSyntax, formattedNode as PragmaChecksumDirectiveTriviaSyntax); - case PragmaWarningDirectiveTriviaSyntax pragmaWarningDirectiveTriviaSyntax: - return this.ComparePragmaWarningDirectiveTriviaSyntax(pragmaWarningDirectiveTriviaSyntax, formattedNode as PragmaWarningDirectiveTriviaSyntax); - case PredefinedTypeSyntax predefinedTypeSyntax: - return this.ComparePredefinedTypeSyntax(predefinedTypeSyntax, formattedNode as PredefinedTypeSyntax); - case PrefixUnaryExpressionSyntax prefixUnaryExpressionSyntax: - return this.ComparePrefixUnaryExpressionSyntax(prefixUnaryExpressionSyntax, formattedNode as PrefixUnaryExpressionSyntax); - case PrimaryConstructorBaseTypeSyntax primaryConstructorBaseTypeSyntax: - return this.ComparePrimaryConstructorBaseTypeSyntax(primaryConstructorBaseTypeSyntax, formattedNode as PrimaryConstructorBaseTypeSyntax); - case PropertyDeclarationSyntax propertyDeclarationSyntax: - return this.ComparePropertyDeclarationSyntax(propertyDeclarationSyntax, formattedNode as PropertyDeclarationSyntax); - case PropertyPatternClauseSyntax propertyPatternClauseSyntax: - return this.ComparePropertyPatternClauseSyntax(propertyPatternClauseSyntax, formattedNode as PropertyPatternClauseSyntax); - case QualifiedCrefSyntax qualifiedCrefSyntax: - return this.CompareQualifiedCrefSyntax(qualifiedCrefSyntax, formattedNode as QualifiedCrefSyntax); - case QualifiedNameSyntax qualifiedNameSyntax: - return this.CompareQualifiedNameSyntax(qualifiedNameSyntax, formattedNode as QualifiedNameSyntax); - case QueryBodySyntax queryBodySyntax: - return this.CompareQueryBodySyntax(queryBodySyntax, formattedNode as QueryBodySyntax); - case QueryContinuationSyntax queryContinuationSyntax: - return this.CompareQueryContinuationSyntax(queryContinuationSyntax, formattedNode as QueryContinuationSyntax); - case QueryExpressionSyntax queryExpressionSyntax: - return this.CompareQueryExpressionSyntax(queryExpressionSyntax, formattedNode as QueryExpressionSyntax); - case RangeExpressionSyntax rangeExpressionSyntax: - return this.CompareRangeExpressionSyntax(rangeExpressionSyntax, formattedNode as RangeExpressionSyntax); - case RecordDeclarationSyntax recordDeclarationSyntax: - return this.CompareRecordDeclarationSyntax(recordDeclarationSyntax, formattedNode as RecordDeclarationSyntax); - case RecursivePatternSyntax recursivePatternSyntax: - return this.CompareRecursivePatternSyntax(recursivePatternSyntax, formattedNode as RecursivePatternSyntax); - case ReferenceDirectiveTriviaSyntax referenceDirectiveTriviaSyntax: - return this.CompareReferenceDirectiveTriviaSyntax(referenceDirectiveTriviaSyntax, formattedNode as ReferenceDirectiveTriviaSyntax); - case RefExpressionSyntax refExpressionSyntax: - return this.CompareRefExpressionSyntax(refExpressionSyntax, formattedNode as RefExpressionSyntax); - case RefTypeExpressionSyntax refTypeExpressionSyntax: - return this.CompareRefTypeExpressionSyntax(refTypeExpressionSyntax, formattedNode as RefTypeExpressionSyntax); - case RefTypeSyntax refTypeSyntax: - return this.CompareRefTypeSyntax(refTypeSyntax, formattedNode as RefTypeSyntax); - case RefValueExpressionSyntax refValueExpressionSyntax: - return this.CompareRefValueExpressionSyntax(refValueExpressionSyntax, formattedNode as RefValueExpressionSyntax); - case RegionDirectiveTriviaSyntax regionDirectiveTriviaSyntax: - return this.CompareRegionDirectiveTriviaSyntax(regionDirectiveTriviaSyntax, formattedNode as RegionDirectiveTriviaSyntax); - case RelationalPatternSyntax relationalPatternSyntax: - return this.CompareRelationalPatternSyntax(relationalPatternSyntax, formattedNode as RelationalPatternSyntax); - case ReturnStatementSyntax returnStatementSyntax: - return this.CompareReturnStatementSyntax(returnStatementSyntax, formattedNode as ReturnStatementSyntax); - case ScopedTypeSyntax scopedTypeSyntax: - return this.CompareScopedTypeSyntax(scopedTypeSyntax, formattedNode as ScopedTypeSyntax); - case SelectClauseSyntax selectClauseSyntax: - return this.CompareSelectClauseSyntax(selectClauseSyntax, formattedNode as SelectClauseSyntax); - case ShebangDirectiveTriviaSyntax shebangDirectiveTriviaSyntax: - return this.CompareShebangDirectiveTriviaSyntax(shebangDirectiveTriviaSyntax, formattedNode as ShebangDirectiveTriviaSyntax); - case SimpleBaseTypeSyntax simpleBaseTypeSyntax: - return this.CompareSimpleBaseTypeSyntax(simpleBaseTypeSyntax, formattedNode as SimpleBaseTypeSyntax); - case SimpleLambdaExpressionSyntax simpleLambdaExpressionSyntax: - return this.CompareSimpleLambdaExpressionSyntax(simpleLambdaExpressionSyntax, formattedNode as SimpleLambdaExpressionSyntax); - case SingleVariableDesignationSyntax singleVariableDesignationSyntax: - return this.CompareSingleVariableDesignationSyntax(singleVariableDesignationSyntax, formattedNode as SingleVariableDesignationSyntax); - case SizeOfExpressionSyntax sizeOfExpressionSyntax: - return this.CompareSizeOfExpressionSyntax(sizeOfExpressionSyntax, formattedNode as SizeOfExpressionSyntax); - case SkippedTokensTriviaSyntax skippedTokensTriviaSyntax: - return this.CompareSkippedTokensTriviaSyntax(skippedTokensTriviaSyntax, formattedNode as SkippedTokensTriviaSyntax); - case SlicePatternSyntax slicePatternSyntax: - return this.CompareSlicePatternSyntax(slicePatternSyntax, formattedNode as SlicePatternSyntax); - case SpreadElementSyntax spreadElementSyntax: - return this.CompareSpreadElementSyntax(spreadElementSyntax, formattedNode as SpreadElementSyntax); - case StackAllocArrayCreationExpressionSyntax stackAllocArrayCreationExpressionSyntax: - return this.CompareStackAllocArrayCreationExpressionSyntax(stackAllocArrayCreationExpressionSyntax, formattedNode as StackAllocArrayCreationExpressionSyntax); - case StructDeclarationSyntax structDeclarationSyntax: - return this.CompareStructDeclarationSyntax(structDeclarationSyntax, formattedNode as StructDeclarationSyntax); - case SubpatternSyntax subpatternSyntax: - return this.CompareSubpatternSyntax(subpatternSyntax, formattedNode as SubpatternSyntax); - case SwitchExpressionArmSyntax switchExpressionArmSyntax: - return this.CompareSwitchExpressionArmSyntax(switchExpressionArmSyntax, formattedNode as SwitchExpressionArmSyntax); - case SwitchExpressionSyntax switchExpressionSyntax: - return this.CompareSwitchExpressionSyntax(switchExpressionSyntax, formattedNode as SwitchExpressionSyntax); - case SwitchSectionSyntax switchSectionSyntax: - return this.CompareSwitchSectionSyntax(switchSectionSyntax, formattedNode as SwitchSectionSyntax); - case SwitchStatementSyntax switchStatementSyntax: - return this.CompareSwitchStatementSyntax(switchStatementSyntax, formattedNode as SwitchStatementSyntax); - case ThisExpressionSyntax thisExpressionSyntax: - return this.CompareThisExpressionSyntax(thisExpressionSyntax, formattedNode as ThisExpressionSyntax); - case ThrowExpressionSyntax throwExpressionSyntax: - return this.CompareThrowExpressionSyntax(throwExpressionSyntax, formattedNode as ThrowExpressionSyntax); - case ThrowStatementSyntax throwStatementSyntax: - return this.CompareThrowStatementSyntax(throwStatementSyntax, formattedNode as ThrowStatementSyntax); - case TryStatementSyntax tryStatementSyntax: - return this.CompareTryStatementSyntax(tryStatementSyntax, formattedNode as TryStatementSyntax); - case TupleElementSyntax tupleElementSyntax: - return this.CompareTupleElementSyntax(tupleElementSyntax, formattedNode as TupleElementSyntax); - case TupleExpressionSyntax tupleExpressionSyntax: - return this.CompareTupleExpressionSyntax(tupleExpressionSyntax, formattedNode as TupleExpressionSyntax); - case TupleTypeSyntax tupleTypeSyntax: - return this.CompareTupleTypeSyntax(tupleTypeSyntax, formattedNode as TupleTypeSyntax); - case TypeArgumentListSyntax typeArgumentListSyntax: - return this.CompareTypeArgumentListSyntax(typeArgumentListSyntax, formattedNode as TypeArgumentListSyntax); - case TypeConstraintSyntax typeConstraintSyntax: - return this.CompareTypeConstraintSyntax(typeConstraintSyntax, formattedNode as TypeConstraintSyntax); - case TypeCrefSyntax typeCrefSyntax: - return this.CompareTypeCrefSyntax(typeCrefSyntax, formattedNode as TypeCrefSyntax); - case TypeOfExpressionSyntax typeOfExpressionSyntax: - return this.CompareTypeOfExpressionSyntax(typeOfExpressionSyntax, formattedNode as TypeOfExpressionSyntax); - case TypeParameterConstraintClauseSyntax typeParameterConstraintClauseSyntax: - return this.CompareTypeParameterConstraintClauseSyntax(typeParameterConstraintClauseSyntax, formattedNode as TypeParameterConstraintClauseSyntax); - case TypeParameterListSyntax typeParameterListSyntax: - return this.CompareTypeParameterListSyntax(typeParameterListSyntax, formattedNode as TypeParameterListSyntax); - case TypeParameterSyntax typeParameterSyntax: - return this.CompareTypeParameterSyntax(typeParameterSyntax, formattedNode as TypeParameterSyntax); - case TypePatternSyntax typePatternSyntax: - return this.CompareTypePatternSyntax(typePatternSyntax, formattedNode as TypePatternSyntax); - case UnaryPatternSyntax unaryPatternSyntax: - return this.CompareUnaryPatternSyntax(unaryPatternSyntax, formattedNode as UnaryPatternSyntax); - case UndefDirectiveTriviaSyntax undefDirectiveTriviaSyntax: - return this.CompareUndefDirectiveTriviaSyntax(undefDirectiveTriviaSyntax, formattedNode as UndefDirectiveTriviaSyntax); - case UnsafeStatementSyntax unsafeStatementSyntax: - return this.CompareUnsafeStatementSyntax(unsafeStatementSyntax, formattedNode as UnsafeStatementSyntax); + case AccessorDeclarationSyntax accessorDeclarationSyntax: + return this.CompareAccessorDeclarationSyntax(accessorDeclarationSyntax, formattedNode as AccessorDeclarationSyntax); + case AccessorListSyntax accessorListSyntax: + return this.CompareAccessorListSyntax(accessorListSyntax, formattedNode as AccessorListSyntax); + case AliasQualifiedNameSyntax aliasQualifiedNameSyntax: + return this.CompareAliasQualifiedNameSyntax(aliasQualifiedNameSyntax, formattedNode as AliasQualifiedNameSyntax); + case AnonymousMethodExpressionSyntax anonymousMethodExpressionSyntax: + return this.CompareAnonymousMethodExpressionSyntax(anonymousMethodExpressionSyntax, formattedNode as AnonymousMethodExpressionSyntax); + case AnonymousObjectCreationExpressionSyntax anonymousObjectCreationExpressionSyntax: + return this.CompareAnonymousObjectCreationExpressionSyntax(anonymousObjectCreationExpressionSyntax, formattedNode as AnonymousObjectCreationExpressionSyntax); + case AnonymousObjectMemberDeclaratorSyntax anonymousObjectMemberDeclaratorSyntax: + return this.CompareAnonymousObjectMemberDeclaratorSyntax(anonymousObjectMemberDeclaratorSyntax, formattedNode as AnonymousObjectMemberDeclaratorSyntax); + case ArgumentListSyntax argumentListSyntax: + return this.CompareArgumentListSyntax(argumentListSyntax, formattedNode as ArgumentListSyntax); + case ArgumentSyntax argumentSyntax: + return this.CompareArgumentSyntax(argumentSyntax, formattedNode as ArgumentSyntax); + case ArrayCreationExpressionSyntax arrayCreationExpressionSyntax: + return this.CompareArrayCreationExpressionSyntax(arrayCreationExpressionSyntax, formattedNode as ArrayCreationExpressionSyntax); + case ArrayRankSpecifierSyntax arrayRankSpecifierSyntax: + return this.CompareArrayRankSpecifierSyntax(arrayRankSpecifierSyntax, formattedNode as ArrayRankSpecifierSyntax); + case ArrayTypeSyntax arrayTypeSyntax: + return this.CompareArrayTypeSyntax(arrayTypeSyntax, formattedNode as ArrayTypeSyntax); + case ArrowExpressionClauseSyntax arrowExpressionClauseSyntax: + return this.CompareArrowExpressionClauseSyntax(arrowExpressionClauseSyntax, formattedNode as ArrowExpressionClauseSyntax); + case AssignmentExpressionSyntax assignmentExpressionSyntax: + return this.CompareAssignmentExpressionSyntax(assignmentExpressionSyntax, formattedNode as AssignmentExpressionSyntax); + case AttributeArgumentListSyntax attributeArgumentListSyntax: + return this.CompareAttributeArgumentListSyntax(attributeArgumentListSyntax, formattedNode as AttributeArgumentListSyntax); + case AttributeArgumentSyntax attributeArgumentSyntax: + return this.CompareAttributeArgumentSyntax(attributeArgumentSyntax, formattedNode as AttributeArgumentSyntax); + case AttributeListSyntax attributeListSyntax: + return this.CompareAttributeListSyntax(attributeListSyntax, formattedNode as AttributeListSyntax); + case AttributeSyntax attributeSyntax: + return this.CompareAttributeSyntax(attributeSyntax, formattedNode as AttributeSyntax); + case AttributeTargetSpecifierSyntax attributeTargetSpecifierSyntax: + return this.CompareAttributeTargetSpecifierSyntax(attributeTargetSpecifierSyntax, formattedNode as AttributeTargetSpecifierSyntax); + case AwaitExpressionSyntax awaitExpressionSyntax: + return this.CompareAwaitExpressionSyntax(awaitExpressionSyntax, formattedNode as AwaitExpressionSyntax); + case BadDirectiveTriviaSyntax badDirectiveTriviaSyntax: + return this.CompareBadDirectiveTriviaSyntax(badDirectiveTriviaSyntax, formattedNode as BadDirectiveTriviaSyntax); + case BaseExpressionSyntax baseExpressionSyntax: + return this.CompareBaseExpressionSyntax(baseExpressionSyntax, formattedNode as BaseExpressionSyntax); + case BaseListSyntax baseListSyntax: + return this.CompareBaseListSyntax(baseListSyntax, formattedNode as BaseListSyntax); + case BinaryExpressionSyntax binaryExpressionSyntax: + return this.CompareBinaryExpressionSyntax(binaryExpressionSyntax, formattedNode as BinaryExpressionSyntax); + case BinaryPatternSyntax binaryPatternSyntax: + return this.CompareBinaryPatternSyntax(binaryPatternSyntax, formattedNode as BinaryPatternSyntax); + case BlockSyntax blockSyntax: + return this.CompareBlockSyntax(blockSyntax, formattedNode as BlockSyntax); + case BracketedArgumentListSyntax bracketedArgumentListSyntax: + return this.CompareBracketedArgumentListSyntax(bracketedArgumentListSyntax, formattedNode as BracketedArgumentListSyntax); + case BracketedParameterListSyntax bracketedParameterListSyntax: + return this.CompareBracketedParameterListSyntax(bracketedParameterListSyntax, formattedNode as BracketedParameterListSyntax); + case BreakStatementSyntax breakStatementSyntax: + return this.CompareBreakStatementSyntax(breakStatementSyntax, formattedNode as BreakStatementSyntax); + case CasePatternSwitchLabelSyntax casePatternSwitchLabelSyntax: + return this.CompareCasePatternSwitchLabelSyntax(casePatternSwitchLabelSyntax, formattedNode as CasePatternSwitchLabelSyntax); + case CaseSwitchLabelSyntax caseSwitchLabelSyntax: + return this.CompareCaseSwitchLabelSyntax(caseSwitchLabelSyntax, formattedNode as CaseSwitchLabelSyntax); + case CastExpressionSyntax castExpressionSyntax: + return this.CompareCastExpressionSyntax(castExpressionSyntax, formattedNode as CastExpressionSyntax); + case CatchClauseSyntax catchClauseSyntax: + return this.CompareCatchClauseSyntax(catchClauseSyntax, formattedNode as CatchClauseSyntax); + case CatchDeclarationSyntax catchDeclarationSyntax: + return this.CompareCatchDeclarationSyntax(catchDeclarationSyntax, formattedNode as CatchDeclarationSyntax); + case CatchFilterClauseSyntax catchFilterClauseSyntax: + return this.CompareCatchFilterClauseSyntax(catchFilterClauseSyntax, formattedNode as CatchFilterClauseSyntax); + case CheckedExpressionSyntax checkedExpressionSyntax: + return this.CompareCheckedExpressionSyntax(checkedExpressionSyntax, formattedNode as CheckedExpressionSyntax); + case CheckedStatementSyntax checkedStatementSyntax: + return this.CompareCheckedStatementSyntax(checkedStatementSyntax, formattedNode as CheckedStatementSyntax); + case ClassDeclarationSyntax classDeclarationSyntax: + return this.CompareClassDeclarationSyntax(classDeclarationSyntax, formattedNode as ClassDeclarationSyntax); + case ClassOrStructConstraintSyntax classOrStructConstraintSyntax: + return this.CompareClassOrStructConstraintSyntax(classOrStructConstraintSyntax, formattedNode as ClassOrStructConstraintSyntax); + case CollectionExpressionSyntax collectionExpressionSyntax: + return this.CompareCollectionExpressionSyntax(collectionExpressionSyntax, formattedNode as CollectionExpressionSyntax); + case CompilationUnitSyntax compilationUnitSyntax: + return this.CompareCompilationUnitSyntax(compilationUnitSyntax, formattedNode as CompilationUnitSyntax); + case ConditionalAccessExpressionSyntax conditionalAccessExpressionSyntax: + return this.CompareConditionalAccessExpressionSyntax(conditionalAccessExpressionSyntax, formattedNode as ConditionalAccessExpressionSyntax); + case ConditionalExpressionSyntax conditionalExpressionSyntax: + return this.CompareConditionalExpressionSyntax(conditionalExpressionSyntax, formattedNode as ConditionalExpressionSyntax); + case ConstantPatternSyntax constantPatternSyntax: + return this.CompareConstantPatternSyntax(constantPatternSyntax, formattedNode as ConstantPatternSyntax); + case ConstructorConstraintSyntax constructorConstraintSyntax: + return this.CompareConstructorConstraintSyntax(constructorConstraintSyntax, formattedNode as ConstructorConstraintSyntax); + case ConstructorDeclarationSyntax constructorDeclarationSyntax: + return this.CompareConstructorDeclarationSyntax(constructorDeclarationSyntax, formattedNode as ConstructorDeclarationSyntax); + case ConstructorInitializerSyntax constructorInitializerSyntax: + return this.CompareConstructorInitializerSyntax(constructorInitializerSyntax, formattedNode as ConstructorInitializerSyntax); + case ContinueStatementSyntax continueStatementSyntax: + return this.CompareContinueStatementSyntax(continueStatementSyntax, formattedNode as ContinueStatementSyntax); + case ConversionOperatorDeclarationSyntax conversionOperatorDeclarationSyntax: + return this.CompareConversionOperatorDeclarationSyntax(conversionOperatorDeclarationSyntax, formattedNode as ConversionOperatorDeclarationSyntax); + case ConversionOperatorMemberCrefSyntax conversionOperatorMemberCrefSyntax: + return this.CompareConversionOperatorMemberCrefSyntax(conversionOperatorMemberCrefSyntax, formattedNode as ConversionOperatorMemberCrefSyntax); + case CrefBracketedParameterListSyntax crefBracketedParameterListSyntax: + return this.CompareCrefBracketedParameterListSyntax(crefBracketedParameterListSyntax, formattedNode as CrefBracketedParameterListSyntax); + case CrefParameterListSyntax crefParameterListSyntax: + return this.CompareCrefParameterListSyntax(crefParameterListSyntax, formattedNode as CrefParameterListSyntax); + case CrefParameterSyntax crefParameterSyntax: + return this.CompareCrefParameterSyntax(crefParameterSyntax, formattedNode as CrefParameterSyntax); + case DeclarationExpressionSyntax declarationExpressionSyntax: + return this.CompareDeclarationExpressionSyntax(declarationExpressionSyntax, formattedNode as DeclarationExpressionSyntax); + case DeclarationPatternSyntax declarationPatternSyntax: + return this.CompareDeclarationPatternSyntax(declarationPatternSyntax, formattedNode as DeclarationPatternSyntax); + case DefaultConstraintSyntax defaultConstraintSyntax: + return this.CompareDefaultConstraintSyntax(defaultConstraintSyntax, formattedNode as DefaultConstraintSyntax); + case DefaultExpressionSyntax defaultExpressionSyntax: + return this.CompareDefaultExpressionSyntax(defaultExpressionSyntax, formattedNode as DefaultExpressionSyntax); + case DefaultSwitchLabelSyntax defaultSwitchLabelSyntax: + return this.CompareDefaultSwitchLabelSyntax(defaultSwitchLabelSyntax, formattedNode as DefaultSwitchLabelSyntax); + case DefineDirectiveTriviaSyntax defineDirectiveTriviaSyntax: + return this.CompareDefineDirectiveTriviaSyntax(defineDirectiveTriviaSyntax, formattedNode as DefineDirectiveTriviaSyntax); + case DelegateDeclarationSyntax delegateDeclarationSyntax: + return this.CompareDelegateDeclarationSyntax(delegateDeclarationSyntax, formattedNode as DelegateDeclarationSyntax); + case DestructorDeclarationSyntax destructorDeclarationSyntax: + return this.CompareDestructorDeclarationSyntax(destructorDeclarationSyntax, formattedNode as DestructorDeclarationSyntax); + case DiscardDesignationSyntax discardDesignationSyntax: + return this.CompareDiscardDesignationSyntax(discardDesignationSyntax, formattedNode as DiscardDesignationSyntax); + case DiscardPatternSyntax discardPatternSyntax: + return this.CompareDiscardPatternSyntax(discardPatternSyntax, formattedNode as DiscardPatternSyntax); + case DocumentationCommentTriviaSyntax documentationCommentTriviaSyntax: + return this.CompareDocumentationCommentTriviaSyntax(documentationCommentTriviaSyntax, formattedNode as DocumentationCommentTriviaSyntax); + case DoStatementSyntax doStatementSyntax: + return this.CompareDoStatementSyntax(doStatementSyntax, formattedNode as DoStatementSyntax); + case ElementAccessExpressionSyntax elementAccessExpressionSyntax: + return this.CompareElementAccessExpressionSyntax(elementAccessExpressionSyntax, formattedNode as ElementAccessExpressionSyntax); + case ElementBindingExpressionSyntax elementBindingExpressionSyntax: + return this.CompareElementBindingExpressionSyntax(elementBindingExpressionSyntax, formattedNode as ElementBindingExpressionSyntax); + case ElifDirectiveTriviaSyntax elifDirectiveTriviaSyntax: + return this.CompareElifDirectiveTriviaSyntax(elifDirectiveTriviaSyntax, formattedNode as ElifDirectiveTriviaSyntax); + case ElseClauseSyntax elseClauseSyntax: + return this.CompareElseClauseSyntax(elseClauseSyntax, formattedNode as ElseClauseSyntax); + case ElseDirectiveTriviaSyntax elseDirectiveTriviaSyntax: + return this.CompareElseDirectiveTriviaSyntax(elseDirectiveTriviaSyntax, formattedNode as ElseDirectiveTriviaSyntax); + case EmptyStatementSyntax emptyStatementSyntax: + return this.CompareEmptyStatementSyntax(emptyStatementSyntax, formattedNode as EmptyStatementSyntax); + case EndIfDirectiveTriviaSyntax endIfDirectiveTriviaSyntax: + return this.CompareEndIfDirectiveTriviaSyntax(endIfDirectiveTriviaSyntax, formattedNode as EndIfDirectiveTriviaSyntax); + case EndRegionDirectiveTriviaSyntax endRegionDirectiveTriviaSyntax: + return this.CompareEndRegionDirectiveTriviaSyntax(endRegionDirectiveTriviaSyntax, formattedNode as EndRegionDirectiveTriviaSyntax); + case EnumDeclarationSyntax enumDeclarationSyntax: + return this.CompareEnumDeclarationSyntax(enumDeclarationSyntax, formattedNode as EnumDeclarationSyntax); + case EnumMemberDeclarationSyntax enumMemberDeclarationSyntax: + return this.CompareEnumMemberDeclarationSyntax(enumMemberDeclarationSyntax, formattedNode as EnumMemberDeclarationSyntax); + case EqualsValueClauseSyntax equalsValueClauseSyntax: + return this.CompareEqualsValueClauseSyntax(equalsValueClauseSyntax, formattedNode as EqualsValueClauseSyntax); + case ErrorDirectiveTriviaSyntax errorDirectiveTriviaSyntax: + return this.CompareErrorDirectiveTriviaSyntax(errorDirectiveTriviaSyntax, formattedNode as ErrorDirectiveTriviaSyntax); + case EventDeclarationSyntax eventDeclarationSyntax: + return this.CompareEventDeclarationSyntax(eventDeclarationSyntax, formattedNode as EventDeclarationSyntax); + case EventFieldDeclarationSyntax eventFieldDeclarationSyntax: + return this.CompareEventFieldDeclarationSyntax(eventFieldDeclarationSyntax, formattedNode as EventFieldDeclarationSyntax); + case ExplicitInterfaceSpecifierSyntax explicitInterfaceSpecifierSyntax: + return this.CompareExplicitInterfaceSpecifierSyntax(explicitInterfaceSpecifierSyntax, formattedNode as ExplicitInterfaceSpecifierSyntax); + case ExpressionColonSyntax expressionColonSyntax: + return this.CompareExpressionColonSyntax(expressionColonSyntax, formattedNode as ExpressionColonSyntax); + case ExpressionElementSyntax expressionElementSyntax: + return this.CompareExpressionElementSyntax(expressionElementSyntax, formattedNode as ExpressionElementSyntax); + case ExpressionStatementSyntax expressionStatementSyntax: + return this.CompareExpressionStatementSyntax(expressionStatementSyntax, formattedNode as ExpressionStatementSyntax); + case ExternAliasDirectiveSyntax externAliasDirectiveSyntax: + return this.CompareExternAliasDirectiveSyntax(externAliasDirectiveSyntax, formattedNode as ExternAliasDirectiveSyntax); + case FieldDeclarationSyntax fieldDeclarationSyntax: + return this.CompareFieldDeclarationSyntax(fieldDeclarationSyntax, formattedNode as FieldDeclarationSyntax); + case FileScopedNamespaceDeclarationSyntax fileScopedNamespaceDeclarationSyntax: + return this.CompareFileScopedNamespaceDeclarationSyntax(fileScopedNamespaceDeclarationSyntax, formattedNode as FileScopedNamespaceDeclarationSyntax); + case FinallyClauseSyntax finallyClauseSyntax: + return this.CompareFinallyClauseSyntax(finallyClauseSyntax, formattedNode as FinallyClauseSyntax); + case FixedStatementSyntax fixedStatementSyntax: + return this.CompareFixedStatementSyntax(fixedStatementSyntax, formattedNode as FixedStatementSyntax); + case ForEachStatementSyntax forEachStatementSyntax: + return this.CompareForEachStatementSyntax(forEachStatementSyntax, formattedNode as ForEachStatementSyntax); + case ForEachVariableStatementSyntax forEachVariableStatementSyntax: + return this.CompareForEachVariableStatementSyntax(forEachVariableStatementSyntax, formattedNode as ForEachVariableStatementSyntax); + case ForStatementSyntax forStatementSyntax: + return this.CompareForStatementSyntax(forStatementSyntax, formattedNode as ForStatementSyntax); + case FromClauseSyntax fromClauseSyntax: + return this.CompareFromClauseSyntax(fromClauseSyntax, formattedNode as FromClauseSyntax); + case FunctionPointerCallingConventionSyntax functionPointerCallingConventionSyntax: + return this.CompareFunctionPointerCallingConventionSyntax(functionPointerCallingConventionSyntax, formattedNode as FunctionPointerCallingConventionSyntax); + case FunctionPointerParameterListSyntax functionPointerParameterListSyntax: + return this.CompareFunctionPointerParameterListSyntax(functionPointerParameterListSyntax, formattedNode as FunctionPointerParameterListSyntax); + case FunctionPointerParameterSyntax functionPointerParameterSyntax: + return this.CompareFunctionPointerParameterSyntax(functionPointerParameterSyntax, formattedNode as FunctionPointerParameterSyntax); + case FunctionPointerTypeSyntax functionPointerTypeSyntax: + return this.CompareFunctionPointerTypeSyntax(functionPointerTypeSyntax, formattedNode as FunctionPointerTypeSyntax); + case FunctionPointerUnmanagedCallingConventionListSyntax functionPointerUnmanagedCallingConventionListSyntax: + return this.CompareFunctionPointerUnmanagedCallingConventionListSyntax(functionPointerUnmanagedCallingConventionListSyntax, formattedNode as FunctionPointerUnmanagedCallingConventionListSyntax); + case FunctionPointerUnmanagedCallingConventionSyntax functionPointerUnmanagedCallingConventionSyntax: + return this.CompareFunctionPointerUnmanagedCallingConventionSyntax(functionPointerUnmanagedCallingConventionSyntax, formattedNode as FunctionPointerUnmanagedCallingConventionSyntax); + case GenericNameSyntax genericNameSyntax: + return this.CompareGenericNameSyntax(genericNameSyntax, formattedNode as GenericNameSyntax); + case GlobalStatementSyntax globalStatementSyntax: + return this.CompareGlobalStatementSyntax(globalStatementSyntax, formattedNode as GlobalStatementSyntax); + case GotoStatementSyntax gotoStatementSyntax: + return this.CompareGotoStatementSyntax(gotoStatementSyntax, formattedNode as GotoStatementSyntax); + case GroupClauseSyntax groupClauseSyntax: + return this.CompareGroupClauseSyntax(groupClauseSyntax, formattedNode as GroupClauseSyntax); + case IdentifierNameSyntax identifierNameSyntax: + return this.CompareIdentifierNameSyntax(identifierNameSyntax, formattedNode as IdentifierNameSyntax); + case IfDirectiveTriviaSyntax ifDirectiveTriviaSyntax: + return this.CompareIfDirectiveTriviaSyntax(ifDirectiveTriviaSyntax, formattedNode as IfDirectiveTriviaSyntax); + case IfStatementSyntax ifStatementSyntax: + return this.CompareIfStatementSyntax(ifStatementSyntax, formattedNode as IfStatementSyntax); + case ImplicitArrayCreationExpressionSyntax implicitArrayCreationExpressionSyntax: + return this.CompareImplicitArrayCreationExpressionSyntax(implicitArrayCreationExpressionSyntax, formattedNode as ImplicitArrayCreationExpressionSyntax); + case ImplicitElementAccessSyntax implicitElementAccessSyntax: + return this.CompareImplicitElementAccessSyntax(implicitElementAccessSyntax, formattedNode as ImplicitElementAccessSyntax); + case ImplicitObjectCreationExpressionSyntax implicitObjectCreationExpressionSyntax: + return this.CompareImplicitObjectCreationExpressionSyntax(implicitObjectCreationExpressionSyntax, formattedNode as ImplicitObjectCreationExpressionSyntax); + case ImplicitStackAllocArrayCreationExpressionSyntax implicitStackAllocArrayCreationExpressionSyntax: + return this.CompareImplicitStackAllocArrayCreationExpressionSyntax(implicitStackAllocArrayCreationExpressionSyntax, formattedNode as ImplicitStackAllocArrayCreationExpressionSyntax); + case IncompleteMemberSyntax incompleteMemberSyntax: + return this.CompareIncompleteMemberSyntax(incompleteMemberSyntax, formattedNode as IncompleteMemberSyntax); + case IndexerDeclarationSyntax indexerDeclarationSyntax: + return this.CompareIndexerDeclarationSyntax(indexerDeclarationSyntax, formattedNode as IndexerDeclarationSyntax); + case IndexerMemberCrefSyntax indexerMemberCrefSyntax: + return this.CompareIndexerMemberCrefSyntax(indexerMemberCrefSyntax, formattedNode as IndexerMemberCrefSyntax); + case InitializerExpressionSyntax initializerExpressionSyntax: + return this.CompareInitializerExpressionSyntax(initializerExpressionSyntax, formattedNode as InitializerExpressionSyntax); + case InterfaceDeclarationSyntax interfaceDeclarationSyntax: + return this.CompareInterfaceDeclarationSyntax(interfaceDeclarationSyntax, formattedNode as InterfaceDeclarationSyntax); + case InterpolatedStringExpressionSyntax interpolatedStringExpressionSyntax: + return this.CompareInterpolatedStringExpressionSyntax(interpolatedStringExpressionSyntax, formattedNode as InterpolatedStringExpressionSyntax); + case InterpolatedStringTextSyntax interpolatedStringTextSyntax: + return this.CompareInterpolatedStringTextSyntax(interpolatedStringTextSyntax, formattedNode as InterpolatedStringTextSyntax); + case InterpolationAlignmentClauseSyntax interpolationAlignmentClauseSyntax: + return this.CompareInterpolationAlignmentClauseSyntax(interpolationAlignmentClauseSyntax, formattedNode as InterpolationAlignmentClauseSyntax); + case InterpolationFormatClauseSyntax interpolationFormatClauseSyntax: + return this.CompareInterpolationFormatClauseSyntax(interpolationFormatClauseSyntax, formattedNode as InterpolationFormatClauseSyntax); + case InterpolationSyntax interpolationSyntax: + return this.CompareInterpolationSyntax(interpolationSyntax, formattedNode as InterpolationSyntax); + case InvocationExpressionSyntax invocationExpressionSyntax: + return this.CompareInvocationExpressionSyntax(invocationExpressionSyntax, formattedNode as InvocationExpressionSyntax); + case IsPatternExpressionSyntax isPatternExpressionSyntax: + return this.CompareIsPatternExpressionSyntax(isPatternExpressionSyntax, formattedNode as IsPatternExpressionSyntax); + case JoinClauseSyntax joinClauseSyntax: + return this.CompareJoinClauseSyntax(joinClauseSyntax, formattedNode as JoinClauseSyntax); + case JoinIntoClauseSyntax joinIntoClauseSyntax: + return this.CompareJoinIntoClauseSyntax(joinIntoClauseSyntax, formattedNode as JoinIntoClauseSyntax); + case LabeledStatementSyntax labeledStatementSyntax: + return this.CompareLabeledStatementSyntax(labeledStatementSyntax, formattedNode as LabeledStatementSyntax); + case LetClauseSyntax letClauseSyntax: + return this.CompareLetClauseSyntax(letClauseSyntax, formattedNode as LetClauseSyntax); + case LineDirectivePositionSyntax lineDirectivePositionSyntax: + return this.CompareLineDirectivePositionSyntax(lineDirectivePositionSyntax, formattedNode as LineDirectivePositionSyntax); + case LineDirectiveTriviaSyntax lineDirectiveTriviaSyntax: + return this.CompareLineDirectiveTriviaSyntax(lineDirectiveTriviaSyntax, formattedNode as LineDirectiveTriviaSyntax); + case LineSpanDirectiveTriviaSyntax lineSpanDirectiveTriviaSyntax: + return this.CompareLineSpanDirectiveTriviaSyntax(lineSpanDirectiveTriviaSyntax, formattedNode as LineSpanDirectiveTriviaSyntax); + case ListPatternSyntax listPatternSyntax: + return this.CompareListPatternSyntax(listPatternSyntax, formattedNode as ListPatternSyntax); + case LiteralExpressionSyntax literalExpressionSyntax: + return this.CompareLiteralExpressionSyntax(literalExpressionSyntax, formattedNode as LiteralExpressionSyntax); + case LoadDirectiveTriviaSyntax loadDirectiveTriviaSyntax: + return this.CompareLoadDirectiveTriviaSyntax(loadDirectiveTriviaSyntax, formattedNode as LoadDirectiveTriviaSyntax); + case LocalDeclarationStatementSyntax localDeclarationStatementSyntax: + return this.CompareLocalDeclarationStatementSyntax(localDeclarationStatementSyntax, formattedNode as LocalDeclarationStatementSyntax); + case LocalFunctionStatementSyntax localFunctionStatementSyntax: + return this.CompareLocalFunctionStatementSyntax(localFunctionStatementSyntax, formattedNode as LocalFunctionStatementSyntax); + case LockStatementSyntax lockStatementSyntax: + return this.CompareLockStatementSyntax(lockStatementSyntax, formattedNode as LockStatementSyntax); + case MakeRefExpressionSyntax makeRefExpressionSyntax: + return this.CompareMakeRefExpressionSyntax(makeRefExpressionSyntax, formattedNode as MakeRefExpressionSyntax); + case MemberAccessExpressionSyntax memberAccessExpressionSyntax: + return this.CompareMemberAccessExpressionSyntax(memberAccessExpressionSyntax, formattedNode as MemberAccessExpressionSyntax); + case MemberBindingExpressionSyntax memberBindingExpressionSyntax: + return this.CompareMemberBindingExpressionSyntax(memberBindingExpressionSyntax, formattedNode as MemberBindingExpressionSyntax); + case MethodDeclarationSyntax methodDeclarationSyntax: + return this.CompareMethodDeclarationSyntax(methodDeclarationSyntax, formattedNode as MethodDeclarationSyntax); + case NameColonSyntax nameColonSyntax: + return this.CompareNameColonSyntax(nameColonSyntax, formattedNode as NameColonSyntax); + case NameEqualsSyntax nameEqualsSyntax: + return this.CompareNameEqualsSyntax(nameEqualsSyntax, formattedNode as NameEqualsSyntax); + case NameMemberCrefSyntax nameMemberCrefSyntax: + return this.CompareNameMemberCrefSyntax(nameMemberCrefSyntax, formattedNode as NameMemberCrefSyntax); + case NamespaceDeclarationSyntax namespaceDeclarationSyntax: + return this.CompareNamespaceDeclarationSyntax(namespaceDeclarationSyntax, formattedNode as NamespaceDeclarationSyntax); + case NullableDirectiveTriviaSyntax nullableDirectiveTriviaSyntax: + return this.CompareNullableDirectiveTriviaSyntax(nullableDirectiveTriviaSyntax, formattedNode as NullableDirectiveTriviaSyntax); + case NullableTypeSyntax nullableTypeSyntax: + return this.CompareNullableTypeSyntax(nullableTypeSyntax, formattedNode as NullableTypeSyntax); + case ObjectCreationExpressionSyntax objectCreationExpressionSyntax: + return this.CompareObjectCreationExpressionSyntax(objectCreationExpressionSyntax, formattedNode as ObjectCreationExpressionSyntax); + case OmittedArraySizeExpressionSyntax omittedArraySizeExpressionSyntax: + return this.CompareOmittedArraySizeExpressionSyntax(omittedArraySizeExpressionSyntax, formattedNode as OmittedArraySizeExpressionSyntax); + case OmittedTypeArgumentSyntax omittedTypeArgumentSyntax: + return this.CompareOmittedTypeArgumentSyntax(omittedTypeArgumentSyntax, formattedNode as OmittedTypeArgumentSyntax); + case OperatorDeclarationSyntax operatorDeclarationSyntax: + return this.CompareOperatorDeclarationSyntax(operatorDeclarationSyntax, formattedNode as OperatorDeclarationSyntax); + case OperatorMemberCrefSyntax operatorMemberCrefSyntax: + return this.CompareOperatorMemberCrefSyntax(operatorMemberCrefSyntax, formattedNode as OperatorMemberCrefSyntax); + case OrderByClauseSyntax orderByClauseSyntax: + return this.CompareOrderByClauseSyntax(orderByClauseSyntax, formattedNode as OrderByClauseSyntax); + case OrderingSyntax orderingSyntax: + return this.CompareOrderingSyntax(orderingSyntax, formattedNode as OrderingSyntax); + case ParameterListSyntax parameterListSyntax: + return this.CompareParameterListSyntax(parameterListSyntax, formattedNode as ParameterListSyntax); + case ParameterSyntax parameterSyntax: + return this.CompareParameterSyntax(parameterSyntax, formattedNode as ParameterSyntax); + case ParenthesizedExpressionSyntax parenthesizedExpressionSyntax: + return this.CompareParenthesizedExpressionSyntax(parenthesizedExpressionSyntax, formattedNode as ParenthesizedExpressionSyntax); + case ParenthesizedLambdaExpressionSyntax parenthesizedLambdaExpressionSyntax: + return this.CompareParenthesizedLambdaExpressionSyntax(parenthesizedLambdaExpressionSyntax, formattedNode as ParenthesizedLambdaExpressionSyntax); + case ParenthesizedPatternSyntax parenthesizedPatternSyntax: + return this.CompareParenthesizedPatternSyntax(parenthesizedPatternSyntax, formattedNode as ParenthesizedPatternSyntax); + case ParenthesizedVariableDesignationSyntax parenthesizedVariableDesignationSyntax: + return this.CompareParenthesizedVariableDesignationSyntax(parenthesizedVariableDesignationSyntax, formattedNode as ParenthesizedVariableDesignationSyntax); + case PointerTypeSyntax pointerTypeSyntax: + return this.ComparePointerTypeSyntax(pointerTypeSyntax, formattedNode as PointerTypeSyntax); + case PositionalPatternClauseSyntax positionalPatternClauseSyntax: + return this.ComparePositionalPatternClauseSyntax(positionalPatternClauseSyntax, formattedNode as PositionalPatternClauseSyntax); + case PostfixUnaryExpressionSyntax postfixUnaryExpressionSyntax: + return this.ComparePostfixUnaryExpressionSyntax(postfixUnaryExpressionSyntax, formattedNode as PostfixUnaryExpressionSyntax); + case PragmaChecksumDirectiveTriviaSyntax pragmaChecksumDirectiveTriviaSyntax: + return this.ComparePragmaChecksumDirectiveTriviaSyntax(pragmaChecksumDirectiveTriviaSyntax, formattedNode as PragmaChecksumDirectiveTriviaSyntax); + case PragmaWarningDirectiveTriviaSyntax pragmaWarningDirectiveTriviaSyntax: + return this.ComparePragmaWarningDirectiveTriviaSyntax(pragmaWarningDirectiveTriviaSyntax, formattedNode as PragmaWarningDirectiveTriviaSyntax); + case PredefinedTypeSyntax predefinedTypeSyntax: + return this.ComparePredefinedTypeSyntax(predefinedTypeSyntax, formattedNode as PredefinedTypeSyntax); + case PrefixUnaryExpressionSyntax prefixUnaryExpressionSyntax: + return this.ComparePrefixUnaryExpressionSyntax(prefixUnaryExpressionSyntax, formattedNode as PrefixUnaryExpressionSyntax); + case PrimaryConstructorBaseTypeSyntax primaryConstructorBaseTypeSyntax: + return this.ComparePrimaryConstructorBaseTypeSyntax(primaryConstructorBaseTypeSyntax, formattedNode as PrimaryConstructorBaseTypeSyntax); + case PropertyDeclarationSyntax propertyDeclarationSyntax: + return this.ComparePropertyDeclarationSyntax(propertyDeclarationSyntax, formattedNode as PropertyDeclarationSyntax); + case PropertyPatternClauseSyntax propertyPatternClauseSyntax: + return this.ComparePropertyPatternClauseSyntax(propertyPatternClauseSyntax, formattedNode as PropertyPatternClauseSyntax); + case QualifiedCrefSyntax qualifiedCrefSyntax: + return this.CompareQualifiedCrefSyntax(qualifiedCrefSyntax, formattedNode as QualifiedCrefSyntax); + case QualifiedNameSyntax qualifiedNameSyntax: + return this.CompareQualifiedNameSyntax(qualifiedNameSyntax, formattedNode as QualifiedNameSyntax); + case QueryBodySyntax queryBodySyntax: + return this.CompareQueryBodySyntax(queryBodySyntax, formattedNode as QueryBodySyntax); + case QueryContinuationSyntax queryContinuationSyntax: + return this.CompareQueryContinuationSyntax(queryContinuationSyntax, formattedNode as QueryContinuationSyntax); + case QueryExpressionSyntax queryExpressionSyntax: + return this.CompareQueryExpressionSyntax(queryExpressionSyntax, formattedNode as QueryExpressionSyntax); + case RangeExpressionSyntax rangeExpressionSyntax: + return this.CompareRangeExpressionSyntax(rangeExpressionSyntax, formattedNode as RangeExpressionSyntax); + case RecordDeclarationSyntax recordDeclarationSyntax: + return this.CompareRecordDeclarationSyntax(recordDeclarationSyntax, formattedNode as RecordDeclarationSyntax); + case RecursivePatternSyntax recursivePatternSyntax: + return this.CompareRecursivePatternSyntax(recursivePatternSyntax, formattedNode as RecursivePatternSyntax); + case ReferenceDirectiveTriviaSyntax referenceDirectiveTriviaSyntax: + return this.CompareReferenceDirectiveTriviaSyntax(referenceDirectiveTriviaSyntax, formattedNode as ReferenceDirectiveTriviaSyntax); + case RefExpressionSyntax refExpressionSyntax: + return this.CompareRefExpressionSyntax(refExpressionSyntax, formattedNode as RefExpressionSyntax); + case RefTypeExpressionSyntax refTypeExpressionSyntax: + return this.CompareRefTypeExpressionSyntax(refTypeExpressionSyntax, formattedNode as RefTypeExpressionSyntax); + case RefTypeSyntax refTypeSyntax: + return this.CompareRefTypeSyntax(refTypeSyntax, formattedNode as RefTypeSyntax); + case RefValueExpressionSyntax refValueExpressionSyntax: + return this.CompareRefValueExpressionSyntax(refValueExpressionSyntax, formattedNode as RefValueExpressionSyntax); + case RegionDirectiveTriviaSyntax regionDirectiveTriviaSyntax: + return this.CompareRegionDirectiveTriviaSyntax(regionDirectiveTriviaSyntax, formattedNode as RegionDirectiveTriviaSyntax); + case RelationalPatternSyntax relationalPatternSyntax: + return this.CompareRelationalPatternSyntax(relationalPatternSyntax, formattedNode as RelationalPatternSyntax); + case ReturnStatementSyntax returnStatementSyntax: + return this.CompareReturnStatementSyntax(returnStatementSyntax, formattedNode as ReturnStatementSyntax); + case ScopedTypeSyntax scopedTypeSyntax: + return this.CompareScopedTypeSyntax(scopedTypeSyntax, formattedNode as ScopedTypeSyntax); + case SelectClauseSyntax selectClauseSyntax: + return this.CompareSelectClauseSyntax(selectClauseSyntax, formattedNode as SelectClauseSyntax); + case ShebangDirectiveTriviaSyntax shebangDirectiveTriviaSyntax: + return this.CompareShebangDirectiveTriviaSyntax(shebangDirectiveTriviaSyntax, formattedNode as ShebangDirectiveTriviaSyntax); + case SimpleBaseTypeSyntax simpleBaseTypeSyntax: + return this.CompareSimpleBaseTypeSyntax(simpleBaseTypeSyntax, formattedNode as SimpleBaseTypeSyntax); + case SimpleLambdaExpressionSyntax simpleLambdaExpressionSyntax: + return this.CompareSimpleLambdaExpressionSyntax(simpleLambdaExpressionSyntax, formattedNode as SimpleLambdaExpressionSyntax); + case SingleVariableDesignationSyntax singleVariableDesignationSyntax: + return this.CompareSingleVariableDesignationSyntax(singleVariableDesignationSyntax, formattedNode as SingleVariableDesignationSyntax); + case SizeOfExpressionSyntax sizeOfExpressionSyntax: + return this.CompareSizeOfExpressionSyntax(sizeOfExpressionSyntax, formattedNode as SizeOfExpressionSyntax); + case SkippedTokensTriviaSyntax skippedTokensTriviaSyntax: + return this.CompareSkippedTokensTriviaSyntax(skippedTokensTriviaSyntax, formattedNode as SkippedTokensTriviaSyntax); + case SlicePatternSyntax slicePatternSyntax: + return this.CompareSlicePatternSyntax(slicePatternSyntax, formattedNode as SlicePatternSyntax); + case SpreadElementSyntax spreadElementSyntax: + return this.CompareSpreadElementSyntax(spreadElementSyntax, formattedNode as SpreadElementSyntax); + case StackAllocArrayCreationExpressionSyntax stackAllocArrayCreationExpressionSyntax: + return this.CompareStackAllocArrayCreationExpressionSyntax(stackAllocArrayCreationExpressionSyntax, formattedNode as StackAllocArrayCreationExpressionSyntax); + case StructDeclarationSyntax structDeclarationSyntax: + return this.CompareStructDeclarationSyntax(structDeclarationSyntax, formattedNode as StructDeclarationSyntax); + case SubpatternSyntax subpatternSyntax: + return this.CompareSubpatternSyntax(subpatternSyntax, formattedNode as SubpatternSyntax); + case SwitchExpressionArmSyntax switchExpressionArmSyntax: + return this.CompareSwitchExpressionArmSyntax(switchExpressionArmSyntax, formattedNode as SwitchExpressionArmSyntax); + case SwitchExpressionSyntax switchExpressionSyntax: + return this.CompareSwitchExpressionSyntax(switchExpressionSyntax, formattedNode as SwitchExpressionSyntax); + case SwitchSectionSyntax switchSectionSyntax: + return this.CompareSwitchSectionSyntax(switchSectionSyntax, formattedNode as SwitchSectionSyntax); + case SwitchStatementSyntax switchStatementSyntax: + return this.CompareSwitchStatementSyntax(switchStatementSyntax, formattedNode as SwitchStatementSyntax); + case ThisExpressionSyntax thisExpressionSyntax: + return this.CompareThisExpressionSyntax(thisExpressionSyntax, formattedNode as ThisExpressionSyntax); + case ThrowExpressionSyntax throwExpressionSyntax: + return this.CompareThrowExpressionSyntax(throwExpressionSyntax, formattedNode as ThrowExpressionSyntax); + case ThrowStatementSyntax throwStatementSyntax: + return this.CompareThrowStatementSyntax(throwStatementSyntax, formattedNode as ThrowStatementSyntax); + case TryStatementSyntax tryStatementSyntax: + return this.CompareTryStatementSyntax(tryStatementSyntax, formattedNode as TryStatementSyntax); + case TupleElementSyntax tupleElementSyntax: + return this.CompareTupleElementSyntax(tupleElementSyntax, formattedNode as TupleElementSyntax); + case TupleExpressionSyntax tupleExpressionSyntax: + return this.CompareTupleExpressionSyntax(tupleExpressionSyntax, formattedNode as TupleExpressionSyntax); + case TupleTypeSyntax tupleTypeSyntax: + return this.CompareTupleTypeSyntax(tupleTypeSyntax, formattedNode as TupleTypeSyntax); + case TypeArgumentListSyntax typeArgumentListSyntax: + return this.CompareTypeArgumentListSyntax(typeArgumentListSyntax, formattedNode as TypeArgumentListSyntax); + case TypeConstraintSyntax typeConstraintSyntax: + return this.CompareTypeConstraintSyntax(typeConstraintSyntax, formattedNode as TypeConstraintSyntax); + case TypeCrefSyntax typeCrefSyntax: + return this.CompareTypeCrefSyntax(typeCrefSyntax, formattedNode as TypeCrefSyntax); + case TypeOfExpressionSyntax typeOfExpressionSyntax: + return this.CompareTypeOfExpressionSyntax(typeOfExpressionSyntax, formattedNode as TypeOfExpressionSyntax); + case TypeParameterConstraintClauseSyntax typeParameterConstraintClauseSyntax: + return this.CompareTypeParameterConstraintClauseSyntax(typeParameterConstraintClauseSyntax, formattedNode as TypeParameterConstraintClauseSyntax); + case TypeParameterListSyntax typeParameterListSyntax: + return this.CompareTypeParameterListSyntax(typeParameterListSyntax, formattedNode as TypeParameterListSyntax); + case TypeParameterSyntax typeParameterSyntax: + return this.CompareTypeParameterSyntax(typeParameterSyntax, formattedNode as TypeParameterSyntax); + case TypePatternSyntax typePatternSyntax: + return this.CompareTypePatternSyntax(typePatternSyntax, formattedNode as TypePatternSyntax); + case UnaryPatternSyntax unaryPatternSyntax: + return this.CompareUnaryPatternSyntax(unaryPatternSyntax, formattedNode as UnaryPatternSyntax); + case UndefDirectiveTriviaSyntax undefDirectiveTriviaSyntax: + return this.CompareUndefDirectiveTriviaSyntax(undefDirectiveTriviaSyntax, formattedNode as UndefDirectiveTriviaSyntax); + case UnsafeStatementSyntax unsafeStatementSyntax: + return this.CompareUnsafeStatementSyntax(unsafeStatementSyntax, formattedNode as UnsafeStatementSyntax); case UsingDirectiveSyntax usingDirectiveSyntax: - if (this.ReorderedModifiers) - return Equal; return this.CompareUsingDirectiveSyntax(usingDirectiveSyntax, formattedNode as UsingDirectiveSyntax); - case UsingStatementSyntax usingStatementSyntax: - return this.CompareUsingStatementSyntax(usingStatementSyntax, formattedNode as UsingStatementSyntax); - case VariableDeclarationSyntax variableDeclarationSyntax: - return this.CompareVariableDeclarationSyntax(variableDeclarationSyntax, formattedNode as VariableDeclarationSyntax); - case VariableDeclaratorSyntax variableDeclaratorSyntax: - return this.CompareVariableDeclaratorSyntax(variableDeclaratorSyntax, formattedNode as VariableDeclaratorSyntax); - case VarPatternSyntax varPatternSyntax: - return this.CompareVarPatternSyntax(varPatternSyntax, formattedNode as VarPatternSyntax); - case WarningDirectiveTriviaSyntax warningDirectiveTriviaSyntax: - return this.CompareWarningDirectiveTriviaSyntax(warningDirectiveTriviaSyntax, formattedNode as WarningDirectiveTriviaSyntax); - case WhenClauseSyntax whenClauseSyntax: - return this.CompareWhenClauseSyntax(whenClauseSyntax, formattedNode as WhenClauseSyntax); - case WhereClauseSyntax whereClauseSyntax: - return this.CompareWhereClauseSyntax(whereClauseSyntax, formattedNode as WhereClauseSyntax); - case WhileStatementSyntax whileStatementSyntax: - return this.CompareWhileStatementSyntax(whileStatementSyntax, formattedNode as WhileStatementSyntax); - case WithExpressionSyntax withExpressionSyntax: - return this.CompareWithExpressionSyntax(withExpressionSyntax, formattedNode as WithExpressionSyntax); - case XmlCDataSectionSyntax xmlCDataSectionSyntax: - return this.CompareXmlCDataSectionSyntax(xmlCDataSectionSyntax, formattedNode as XmlCDataSectionSyntax); - case XmlCommentSyntax xmlCommentSyntax: - return this.CompareXmlCommentSyntax(xmlCommentSyntax, formattedNode as XmlCommentSyntax); - case XmlCrefAttributeSyntax xmlCrefAttributeSyntax: - return this.CompareXmlCrefAttributeSyntax(xmlCrefAttributeSyntax, formattedNode as XmlCrefAttributeSyntax); - case XmlElementEndTagSyntax xmlElementEndTagSyntax: - return this.CompareXmlElementEndTagSyntax(xmlElementEndTagSyntax, formattedNode as XmlElementEndTagSyntax); - case XmlElementStartTagSyntax xmlElementStartTagSyntax: - return this.CompareXmlElementStartTagSyntax(xmlElementStartTagSyntax, formattedNode as XmlElementStartTagSyntax); - case XmlElementSyntax xmlElementSyntax: - return this.CompareXmlElementSyntax(xmlElementSyntax, formattedNode as XmlElementSyntax); - case XmlEmptyElementSyntax xmlEmptyElementSyntax: - return this.CompareXmlEmptyElementSyntax(xmlEmptyElementSyntax, formattedNode as XmlEmptyElementSyntax); - case XmlNameAttributeSyntax xmlNameAttributeSyntax: - return this.CompareXmlNameAttributeSyntax(xmlNameAttributeSyntax, formattedNode as XmlNameAttributeSyntax); - case XmlNameSyntax xmlNameSyntax: - return this.CompareXmlNameSyntax(xmlNameSyntax, formattedNode as XmlNameSyntax); - case XmlPrefixSyntax xmlPrefixSyntax: - return this.CompareXmlPrefixSyntax(xmlPrefixSyntax, formattedNode as XmlPrefixSyntax); - case XmlProcessingInstructionSyntax xmlProcessingInstructionSyntax: - return this.CompareXmlProcessingInstructionSyntax(xmlProcessingInstructionSyntax, formattedNode as XmlProcessingInstructionSyntax); - case XmlTextAttributeSyntax xmlTextAttributeSyntax: - return this.CompareXmlTextAttributeSyntax(xmlTextAttributeSyntax, formattedNode as XmlTextAttributeSyntax); - case XmlTextSyntax xmlTextSyntax: - return this.CompareXmlTextSyntax(xmlTextSyntax, formattedNode as XmlTextSyntax); - case YieldStatementSyntax yieldStatementSyntax: - return this.CompareYieldStatementSyntax(yieldStatementSyntax, formattedNode as YieldStatementSyntax); + case UsingStatementSyntax usingStatementSyntax: + return this.CompareUsingStatementSyntax(usingStatementSyntax, formattedNode as UsingStatementSyntax); + case VariableDeclarationSyntax variableDeclarationSyntax: + return this.CompareVariableDeclarationSyntax(variableDeclarationSyntax, formattedNode as VariableDeclarationSyntax); + case VariableDeclaratorSyntax variableDeclaratorSyntax: + return this.CompareVariableDeclaratorSyntax(variableDeclaratorSyntax, formattedNode as VariableDeclaratorSyntax); + case VarPatternSyntax varPatternSyntax: + return this.CompareVarPatternSyntax(varPatternSyntax, formattedNode as VarPatternSyntax); + case WarningDirectiveTriviaSyntax warningDirectiveTriviaSyntax: + return this.CompareWarningDirectiveTriviaSyntax(warningDirectiveTriviaSyntax, formattedNode as WarningDirectiveTriviaSyntax); + case WhenClauseSyntax whenClauseSyntax: + return this.CompareWhenClauseSyntax(whenClauseSyntax, formattedNode as WhenClauseSyntax); + case WhereClauseSyntax whereClauseSyntax: + return this.CompareWhereClauseSyntax(whereClauseSyntax, formattedNode as WhereClauseSyntax); + case WhileStatementSyntax whileStatementSyntax: + return this.CompareWhileStatementSyntax(whileStatementSyntax, formattedNode as WhileStatementSyntax); + case WithExpressionSyntax withExpressionSyntax: + return this.CompareWithExpressionSyntax(withExpressionSyntax, formattedNode as WithExpressionSyntax); + case XmlCDataSectionSyntax xmlCDataSectionSyntax: + return this.CompareXmlCDataSectionSyntax(xmlCDataSectionSyntax, formattedNode as XmlCDataSectionSyntax); + case XmlCommentSyntax xmlCommentSyntax: + return this.CompareXmlCommentSyntax(xmlCommentSyntax, formattedNode as XmlCommentSyntax); + case XmlCrefAttributeSyntax xmlCrefAttributeSyntax: + return this.CompareXmlCrefAttributeSyntax(xmlCrefAttributeSyntax, formattedNode as XmlCrefAttributeSyntax); + case XmlElementEndTagSyntax xmlElementEndTagSyntax: + return this.CompareXmlElementEndTagSyntax(xmlElementEndTagSyntax, formattedNode as XmlElementEndTagSyntax); + case XmlElementStartTagSyntax xmlElementStartTagSyntax: + return this.CompareXmlElementStartTagSyntax(xmlElementStartTagSyntax, formattedNode as XmlElementStartTagSyntax); + case XmlElementSyntax xmlElementSyntax: + return this.CompareXmlElementSyntax(xmlElementSyntax, formattedNode as XmlElementSyntax); + case XmlEmptyElementSyntax xmlEmptyElementSyntax: + return this.CompareXmlEmptyElementSyntax(xmlEmptyElementSyntax, formattedNode as XmlEmptyElementSyntax); + case XmlNameAttributeSyntax xmlNameAttributeSyntax: + return this.CompareXmlNameAttributeSyntax(xmlNameAttributeSyntax, formattedNode as XmlNameAttributeSyntax); + case XmlNameSyntax xmlNameSyntax: + return this.CompareXmlNameSyntax(xmlNameSyntax, formattedNode as XmlNameSyntax); + case XmlPrefixSyntax xmlPrefixSyntax: + return this.CompareXmlPrefixSyntax(xmlPrefixSyntax, formattedNode as XmlPrefixSyntax); + case XmlProcessingInstructionSyntax xmlProcessingInstructionSyntax: + return this.CompareXmlProcessingInstructionSyntax(xmlProcessingInstructionSyntax, formattedNode as XmlProcessingInstructionSyntax); + case XmlTextAttributeSyntax xmlTextAttributeSyntax: + return this.CompareXmlTextAttributeSyntax(xmlTextAttributeSyntax, formattedNode as XmlTextAttributeSyntax); + case XmlTextSyntax xmlTextSyntax: + return this.CompareXmlTextSyntax(xmlTextSyntax, formattedNode as XmlTextSyntax); + case YieldStatementSyntax yieldStatementSyntax: + return this.CompareYieldStatementSyntax(yieldStatementSyntax, formattedNode as YieldStatementSyntax); default: #if DEBUG throw new Exception("Can't handle " + originalNode.GetType().Name); @@ -531,9 +529,9 @@ private CompareResult Compare( } } - private CompareResult CompareAccessorDeclarationSyntax(AccessorDeclarationSyntax originalNode, AccessorDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAccessorDeclarationSyntax(AccessorDeclarationSyntax originalNode, AccessorDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -549,9 +547,9 @@ private CompareResult CompareAccessorDeclarationSyntax(AccessorDeclarationSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareAccessorListSyntax(AccessorListSyntax originalNode, AccessorListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAccessorListSyntax(AccessorListSyntax originalNode, AccessorListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Accessors, formattedNode.Accessors, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); @@ -561,9 +559,9 @@ private CompareResult CompareAccessorListSyntax(AccessorListSyntax originalNode, if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareAliasQualifiedNameSyntax(AliasQualifiedNameSyntax originalNode, AliasQualifiedNameSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAliasQualifiedNameSyntax(AliasQualifiedNameSyntax originalNode, AliasQualifiedNameSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Alias, originalNode)); formattedStack.Push((formattedNode.Alias, formattedNode)); result = this.Compare(originalNode.ColonColonToken, formattedNode.ColonColonToken, originalNode, formattedNode); @@ -578,9 +576,9 @@ private CompareResult CompareAliasQualifiedNameSyntax(AliasQualifiedNameSyntax o formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareAnonymousMethodExpressionSyntax(AnonymousMethodExpressionSyntax originalNode, AnonymousMethodExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAnonymousMethodExpressionSyntax(AnonymousMethodExpressionSyntax originalNode, AnonymousMethodExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AsyncKeyword, formattedNode.AsyncKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Block, originalNode)); @@ -598,14 +596,14 @@ private CompareResult CompareAnonymousMethodExpressionSyntax(AnonymousMethodExpr formattedStack.Push((formattedNode.ParameterList, formattedNode)); return Equal; } - private CompareResult CompareAnonymousObjectCreationExpressionSyntax(AnonymousObjectCreationExpressionSyntax originalNode, AnonymousObjectCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAnonymousObjectCreationExpressionSyntax(AnonymousObjectCreationExpressionSyntax originalNode, AnonymousObjectCreationExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Initializers, formattedNode.Initializers, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Initializers.GetSeparators().ToList(), formattedNode.Initializers.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Initializers.GetSeparators().Take(originalNode.Initializers.Count() - 1).ToList(), formattedNode.Initializers.GetSeparators().Take(formattedNode.Initializers.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.NewKeyword, formattedNode.NewKeyword, originalNode, formattedNode); @@ -614,9 +612,9 @@ private CompareResult CompareAnonymousObjectCreationExpressionSyntax(AnonymousOb if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareAnonymousObjectMemberDeclaratorSyntax(AnonymousObjectMemberDeclaratorSyntax originalNode, AnonymousObjectMemberDeclaratorSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAnonymousObjectMemberDeclaratorSyntax(AnonymousObjectMemberDeclaratorSyntax originalNode, AnonymousObjectMemberDeclaratorSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -624,12 +622,12 @@ private CompareResult CompareAnonymousObjectMemberDeclaratorSyntax(AnonymousObje formattedStack.Push((formattedNode.NameEquals, formattedNode)); return Equal; } - private CompareResult CompareArgumentListSyntax(ArgumentListSyntax originalNode, ArgumentListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArgumentListSyntax(ArgumentListSyntax originalNode, ArgumentListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arguments, formattedNode.Arguments, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arguments.GetSeparators().ToList(), formattedNode.Arguments.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arguments.GetSeparators().Take(originalNode.Arguments.Count() - 1).ToList(), formattedNode.Arguments.GetSeparators().Take(formattedNode.Arguments.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -638,9 +636,9 @@ private CompareResult CompareArgumentListSyntax(ArgumentListSyntax originalNode, if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareArgumentSyntax(ArgumentSyntax originalNode, ArgumentSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArgumentSyntax(ArgumentSyntax originalNode, ArgumentSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -652,9 +650,9 @@ private CompareResult CompareArgumentSyntax(ArgumentSyntax originalNode, Argumen if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareArrayCreationExpressionSyntax(ArrayCreationExpressionSyntax originalNode, ArrayCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArrayCreationExpressionSyntax(ArrayCreationExpressionSyntax originalNode, ArrayCreationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Initializer, originalNode)); formattedStack.Push((formattedNode.Initializer, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -664,9 +662,9 @@ private CompareResult CompareArrayCreationExpressionSyntax(ArrayCreationExpressi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareArrayRankSpecifierSyntax(ArrayRankSpecifierSyntax originalNode, ArrayRankSpecifierSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArrayRankSpecifierSyntax(ArrayRankSpecifierSyntax originalNode, ArrayRankSpecifierSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -675,13 +673,13 @@ private CompareResult CompareArrayRankSpecifierSyntax(ArrayRankSpecifierSyntax o if (originalNode.Rank != formattedNode.Rank) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.Sizes, formattedNode.Sizes, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Sizes.GetSeparators().ToList(), formattedNode.Sizes.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Sizes.GetSeparators().Take(originalNode.Sizes.Count() - 1).ToList(), formattedNode.Sizes.GetSeparators().Take(formattedNode.Sizes.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareArrayTypeSyntax(ArrayTypeSyntax originalNode, ArrayTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArrayTypeSyntax(ArrayTypeSyntax originalNode, ArrayTypeSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ElementType, originalNode)); formattedStack.Push((formattedNode.ElementType, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -694,9 +692,9 @@ private CompareResult CompareArrayTypeSyntax(ArrayTypeSyntax originalNode, Array if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareArrowExpressionClauseSyntax(ArrowExpressionClauseSyntax originalNode, ArrowExpressionClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareArrowExpressionClauseSyntax(ArrowExpressionClauseSyntax originalNode, ArrowExpressionClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ArrowToken, formattedNode.ArrowToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -704,9 +702,9 @@ private CompareResult CompareArrowExpressionClauseSyntax(ArrowExpressionClauseSy if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareAssignmentExpressionSyntax(AssignmentExpressionSyntax originalNode, AssignmentExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAssignmentExpressionSyntax(AssignmentExpressionSyntax originalNode, AssignmentExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Left, originalNode)); formattedStack.Push((formattedNode.Left, formattedNode)); @@ -716,12 +714,12 @@ private CompareResult CompareAssignmentExpressionSyntax(AssignmentExpressionSynt formattedStack.Push((formattedNode.Right, formattedNode)); return Equal; } - private CompareResult CompareAttributeArgumentListSyntax(AttributeArgumentListSyntax originalNode, AttributeArgumentListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAttributeArgumentListSyntax(AttributeArgumentListSyntax originalNode, AttributeArgumentListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arguments, formattedNode.Arguments, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arguments.GetSeparators().ToList(), formattedNode.Arguments.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arguments.GetSeparators().Take(originalNode.Arguments.Count() - 1).ToList(), formattedNode.Arguments.GetSeparators().Take(formattedNode.Arguments.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -730,9 +728,9 @@ private CompareResult CompareAttributeArgumentListSyntax(AttributeArgumentListSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareAttributeArgumentSyntax(AttributeArgumentSyntax originalNode, AttributeArgumentSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAttributeArgumentSyntax(AttributeArgumentSyntax originalNode, AttributeArgumentSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -742,12 +740,12 @@ private CompareResult CompareAttributeArgumentSyntax(AttributeArgumentSyntax ori formattedStack.Push((formattedNode.NameEquals, formattedNode)); return Equal; } - private CompareResult CompareAttributeListSyntax(AttributeListSyntax originalNode, AttributeListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAttributeListSyntax(AttributeListSyntax originalNode, AttributeListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Attributes, formattedNode.Attributes, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Attributes.GetSeparators().ToList(), formattedNode.Attributes.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Attributes.GetSeparators().Take(originalNode.Attributes.Count() - 1).ToList(), formattedNode.Attributes.GetSeparators().Take(formattedNode.Attributes.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -758,9 +756,9 @@ private CompareResult CompareAttributeListSyntax(AttributeListSyntax originalNod formattedStack.Push((formattedNode.Target, formattedNode)); return Equal; } - private CompareResult CompareAttributeSyntax(AttributeSyntax originalNode, AttributeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAttributeSyntax(AttributeSyntax originalNode, AttributeSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -768,9 +766,9 @@ private CompareResult CompareAttributeSyntax(AttributeSyntax originalNode, Attri formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareAttributeTargetSpecifierSyntax(AttributeTargetSpecifierSyntax originalNode, AttributeTargetSpecifierSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAttributeTargetSpecifierSyntax(AttributeTargetSpecifierSyntax originalNode, AttributeTargetSpecifierSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -778,9 +776,9 @@ private CompareResult CompareAttributeTargetSpecifierSyntax(AttributeTargetSpeci if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareAwaitExpressionSyntax(AwaitExpressionSyntax originalNode, AwaitExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareAwaitExpressionSyntax(AwaitExpressionSyntax originalNode, AwaitExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AwaitKeyword, formattedNode.AwaitKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -788,9 +786,9 @@ private CompareResult CompareAwaitExpressionSyntax(AwaitExpressionSyntax origina if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareBadDirectiveTriviaSyntax(BadDirectiveTriviaSyntax originalNode, BadDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBadDirectiveTriviaSyntax(BadDirectiveTriviaSyntax originalNode, BadDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -803,29 +801,29 @@ private CompareResult CompareBadDirectiveTriviaSyntax(BadDirectiveTriviaSyntax o if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareBaseExpressionSyntax(BaseExpressionSyntax originalNode, BaseExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBaseExpressionSyntax(BaseExpressionSyntax originalNode, BaseExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.Token, formattedNode.Token, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareBaseListSyntax(BaseListSyntax originalNode, BaseListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBaseListSyntax(BaseListSyntax originalNode, BaseListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.Types, formattedNode.Types, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Types.GetSeparators().ToList(), formattedNode.Types.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Types.GetSeparators().Take(originalNode.Types.Count() - 1).ToList(), formattedNode.Types.GetSeparators().Take(formattedNode.Types.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareBinaryExpressionSyntax(BinaryExpressionSyntax originalNode, BinaryExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBinaryExpressionSyntax(BinaryExpressionSyntax originalNode, BinaryExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Left, originalNode)); formattedStack.Push((formattedNode.Left, formattedNode)); @@ -835,9 +833,9 @@ private CompareResult CompareBinaryExpressionSyntax(BinaryExpressionSyntax origi formattedStack.Push((formattedNode.Right, formattedNode)); return Equal; } - private CompareResult CompareBinaryPatternSyntax(BinaryPatternSyntax originalNode, BinaryPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBinaryPatternSyntax(BinaryPatternSyntax originalNode, BinaryPatternSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Left, originalNode)); formattedStack.Push((formattedNode.Left, formattedNode)); @@ -847,9 +845,9 @@ private CompareResult CompareBinaryPatternSyntax(BinaryPatternSyntax originalNod formattedStack.Push((formattedNode.Right, formattedNode)); return Equal; } - private CompareResult CompareBlockSyntax(BlockSyntax originalNode, BlockSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBlockSyntax(BlockSyntax originalNode, BlockSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); @@ -861,12 +859,12 @@ private CompareResult CompareBlockSyntax(BlockSyntax originalNode, BlockSyntax f if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareBracketedArgumentListSyntax(BracketedArgumentListSyntax originalNode, BracketedArgumentListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBracketedArgumentListSyntax(BracketedArgumentListSyntax originalNode, BracketedArgumentListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arguments, formattedNode.Arguments, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arguments.GetSeparators().ToList(), formattedNode.Arguments.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arguments.GetSeparators().Take(originalNode.Arguments.Count() - 1).ToList(), formattedNode.Arguments.GetSeparators().Take(formattedNode.Arguments.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -875,9 +873,9 @@ private CompareResult CompareBracketedArgumentListSyntax(BracketedArgumentListSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareBracketedParameterListSyntax(BracketedParameterListSyntax originalNode, BracketedParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBracketedParameterListSyntax(BracketedParameterListSyntax originalNode, BracketedParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -885,13 +883,13 @@ private CompareResult CompareBracketedParameterListSyntax(BracketedParameterList if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareBreakStatementSyntax(BreakStatementSyntax originalNode, BreakStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareBreakStatementSyntax(BreakStatementSyntax originalNode, BreakStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.BreakKeyword, formattedNode.BreakKeyword, originalNode, formattedNode); @@ -901,9 +899,9 @@ private CompareResult CompareBreakStatementSyntax(BreakStatementSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCasePatternSwitchLabelSyntax(CasePatternSwitchLabelSyntax originalNode, CasePatternSwitchLabelSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCasePatternSwitchLabelSyntax(CasePatternSwitchLabelSyntax originalNode, CasePatternSwitchLabelSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -915,9 +913,9 @@ private CompareResult CompareCasePatternSwitchLabelSyntax(CasePatternSwitchLabel formattedStack.Push((formattedNode.WhenClause, formattedNode)); return Equal; } - private CompareResult CompareCaseSwitchLabelSyntax(CaseSwitchLabelSyntax originalNode, CaseSwitchLabelSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCaseSwitchLabelSyntax(CaseSwitchLabelSyntax originalNode, CaseSwitchLabelSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -927,9 +925,9 @@ private CompareResult CompareCaseSwitchLabelSyntax(CaseSwitchLabelSyntax origina formattedStack.Push((formattedNode.Value, formattedNode)); return Equal; } - private CompareResult CompareCastExpressionSyntax(CastExpressionSyntax originalNode, CastExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCastExpressionSyntax(CastExpressionSyntax originalNode, CastExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -941,9 +939,9 @@ private CompareResult CompareCastExpressionSyntax(CastExpressionSyntax originalN formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareCatchClauseSyntax(CatchClauseSyntax originalNode, CatchClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCatchClauseSyntax(CatchClauseSyntax originalNode, CatchClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Block, originalNode)); formattedStack.Push((formattedNode.Block, formattedNode)); result = this.Compare(originalNode.CatchKeyword, formattedNode.CatchKeyword, originalNode, formattedNode); @@ -955,9 +953,9 @@ private CompareResult CompareCatchClauseSyntax(CatchClauseSyntax originalNode, C if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareCatchDeclarationSyntax(CatchDeclarationSyntax originalNode, CatchDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCatchDeclarationSyntax(CatchDeclarationSyntax originalNode, CatchDeclarationSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -969,9 +967,9 @@ private CompareResult CompareCatchDeclarationSyntax(CatchDeclarationSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareCatchFilterClauseSyntax(CatchFilterClauseSyntax originalNode, CatchFilterClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCatchFilterClauseSyntax(CatchFilterClauseSyntax originalNode, CatchFilterClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.FilterExpression, originalNode)); @@ -983,9 +981,9 @@ private CompareResult CompareCatchFilterClauseSyntax(CatchFilterClauseSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCheckedExpressionSyntax(CheckedExpressionSyntax originalNode, CheckedExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCheckedExpressionSyntax(CheckedExpressionSyntax originalNode, CheckedExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -997,9 +995,9 @@ private CompareResult CompareCheckedExpressionSyntax(CheckedExpressionSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCheckedStatementSyntax(CheckedStatementSyntax originalNode, CheckedStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCheckedStatementSyntax(CheckedStatementSyntax originalNode, CheckedStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Block, originalNode)); @@ -1009,9 +1007,9 @@ private CompareResult CompareCheckedStatementSyntax(CheckedStatementSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareClassDeclarationSyntax(ClassDeclarationSyntax originalNode, ClassDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareClassDeclarationSyntax(ClassDeclarationSyntax originalNode, ClassDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.BaseList, originalNode)); @@ -1039,9 +1037,9 @@ private CompareResult CompareClassDeclarationSyntax(ClassDeclarationSyntax origi formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareClassOrStructConstraintSyntax(ClassOrStructConstraintSyntax originalNode, ClassOrStructConstraintSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareClassOrStructConstraintSyntax(ClassOrStructConstraintSyntax originalNode, ClassOrStructConstraintSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ClassOrStructKeyword, formattedNode.ClassOrStructKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1049,23 +1047,23 @@ private CompareResult CompareClassOrStructConstraintSyntax(ClassOrStructConstrai if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCollectionExpressionSyntax(CollectionExpressionSyntax originalNode, CollectionExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCollectionExpressionSyntax(CollectionExpressionSyntax originalNode, CollectionExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Elements, formattedNode.Elements, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Elements.GetSeparators().ToList(), formattedNode.Elements.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Elements.GetSeparators().Take(originalNode.Elements.Count() - 1).ToList(), formattedNode.Elements.GetSeparators().Take(formattedNode.Elements.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OpenBracketToken, formattedNode.OpenBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCompilationUnitSyntax(CompilationUnitSyntax originalNode, CompilationUnitSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCompilationUnitSyntax(CompilationUnitSyntax originalNode, CompilationUnitSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfFileToken, formattedNode.EndOfFileToken, originalNode, formattedNode); @@ -1079,9 +1077,9 @@ private CompareResult CompareCompilationUnitSyntax(CompilationUnitSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareConditionalAccessExpressionSyntax(ConditionalAccessExpressionSyntax originalNode, ConditionalAccessExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConditionalAccessExpressionSyntax(ConditionalAccessExpressionSyntax originalNode, ConditionalAccessExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1091,9 +1089,9 @@ private CompareResult CompareConditionalAccessExpressionSyntax(ConditionalAccess formattedStack.Push((formattedNode.WhenNotNull, formattedNode)); return Equal; } - private CompareResult CompareConditionalExpressionSyntax(ConditionalExpressionSyntax originalNode, ConditionalExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConditionalExpressionSyntax(ConditionalExpressionSyntax originalNode, ConditionalExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Condition, originalNode)); @@ -1107,17 +1105,17 @@ private CompareResult CompareConditionalExpressionSyntax(ConditionalExpressionSy formattedStack.Push((formattedNode.WhenTrue, formattedNode)); return Equal; } - private CompareResult CompareConstantPatternSyntax(ConstantPatternSyntax originalNode, ConstantPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConstantPatternSyntax(ConstantPatternSyntax originalNode, ConstantPatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareConstructorConstraintSyntax(ConstructorConstraintSyntax originalNode, ConstructorConstraintSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConstructorConstraintSyntax(ConstructorConstraintSyntax originalNode, ConstructorConstraintSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1127,9 +1125,9 @@ private CompareResult CompareConstructorConstraintSyntax(ConstructorConstraintSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareConstructorDeclarationSyntax(ConstructorDeclarationSyntax originalNode, ConstructorDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConstructorDeclarationSyntax(ConstructorDeclarationSyntax originalNode, ConstructorDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -1149,9 +1147,9 @@ private CompareResult CompareConstructorDeclarationSyntax(ConstructorDeclaration if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareConstructorInitializerSyntax(ConstructorInitializerSyntax originalNode, ConstructorInitializerSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConstructorInitializerSyntax(ConstructorInitializerSyntax originalNode, ConstructorInitializerSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); @@ -1161,9 +1159,9 @@ private CompareResult CompareConstructorInitializerSyntax(ConstructorInitializer if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareContinueStatementSyntax(ContinueStatementSyntax originalNode, ContinueStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareContinueStatementSyntax(ContinueStatementSyntax originalNode, ContinueStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.ContinueKeyword, formattedNode.ContinueKeyword, originalNode, formattedNode); @@ -1173,9 +1171,9 @@ private CompareResult CompareContinueStatementSyntax(ContinueStatementSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareConversionOperatorDeclarationSyntax(ConversionOperatorDeclarationSyntax originalNode, ConversionOperatorDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConversionOperatorDeclarationSyntax(ConversionOperatorDeclarationSyntax originalNode, ConversionOperatorDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -1201,9 +1199,9 @@ private CompareResult CompareConversionOperatorDeclarationSyntax(ConversionOpera formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareConversionOperatorMemberCrefSyntax(ConversionOperatorMemberCrefSyntax originalNode, ConversionOperatorMemberCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareConversionOperatorMemberCrefSyntax(ConversionOperatorMemberCrefSyntax originalNode, ConversionOperatorMemberCrefSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CheckedKeyword, formattedNode.CheckedKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.ImplicitOrExplicitKeyword, formattedNode.ImplicitOrExplicitKeyword, originalNode, formattedNode); @@ -1217,9 +1215,9 @@ private CompareResult CompareConversionOperatorMemberCrefSyntax(ConversionOperat formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareCrefBracketedParameterListSyntax(CrefBracketedParameterListSyntax originalNode, CrefBracketedParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCrefBracketedParameterListSyntax(CrefBracketedParameterListSyntax originalNode, CrefBracketedParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1227,13 +1225,13 @@ private CompareResult CompareCrefBracketedParameterListSyntax(CrefBracketedParam if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCrefParameterListSyntax(CrefParameterListSyntax originalNode, CrefParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCrefParameterListSyntax(CrefParameterListSyntax originalNode, CrefParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1241,14 +1239,16 @@ private CompareResult CompareCrefParameterListSyntax(CrefParameterListSyntax ori if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareCrefParameterSyntax(CrefParameterSyntax originalNode, CrefParameterSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareCrefParameterSyntax(CrefParameterSyntax originalNode, CrefParameterSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); + result = this.Compare(originalNode.ReadOnlyKeyword, formattedNode.ReadOnlyKeyword, originalNode, formattedNode); + if (result.IsInvalid) return result; result = this.Compare(originalNode.RefKindKeyword, formattedNode.RefKindKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.RefOrOutKeyword, formattedNode.RefOrOutKeyword, originalNode, formattedNode); @@ -1257,9 +1257,9 @@ private CompareResult CompareCrefParameterSyntax(CrefParameterSyntax originalNod formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareDeclarationExpressionSyntax(DeclarationExpressionSyntax originalNode, DeclarationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDeclarationExpressionSyntax(DeclarationExpressionSyntax originalNode, DeclarationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Designation, originalNode)); formattedStack.Push((formattedNode.Designation, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1267,9 +1267,9 @@ private CompareResult CompareDeclarationExpressionSyntax(DeclarationExpressionSy formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareDeclarationPatternSyntax(DeclarationPatternSyntax originalNode, DeclarationPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDeclarationPatternSyntax(DeclarationPatternSyntax originalNode, DeclarationPatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Designation, originalNode)); formattedStack.Push((formattedNode.Designation, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1277,17 +1277,17 @@ private CompareResult CompareDeclarationPatternSyntax(DeclarationPatternSyntax o formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareDefaultConstraintSyntax(DefaultConstraintSyntax originalNode, DefaultConstraintSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDefaultConstraintSyntax(DefaultConstraintSyntax originalNode, DefaultConstraintSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DefaultKeyword, formattedNode.DefaultKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareDefaultExpressionSyntax(DefaultExpressionSyntax originalNode, DefaultExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDefaultExpressionSyntax(DefaultExpressionSyntax originalNode, DefaultExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1299,9 +1299,9 @@ private CompareResult CompareDefaultExpressionSyntax(DefaultExpressionSyntax ori formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareDefaultSwitchLabelSyntax(DefaultSwitchLabelSyntax originalNode, DefaultSwitchLabelSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDefaultSwitchLabelSyntax(DefaultSwitchLabelSyntax originalNode, DefaultSwitchLabelSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1309,9 +1309,9 @@ private CompareResult CompareDefaultSwitchLabelSyntax(DefaultSwitchLabelSyntax o if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareDefineDirectiveTriviaSyntax(DefineDirectiveTriviaSyntax originalNode, DefineDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDefineDirectiveTriviaSyntax(DefineDirectiveTriviaSyntax originalNode, DefineDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DefineKeyword, formattedNode.DefineKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); @@ -1326,9 +1326,9 @@ private CompareResult CompareDefineDirectiveTriviaSyntax(DefineDirectiveTriviaSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareDelegateDeclarationSyntax(DelegateDeclarationSyntax originalNode, DelegateDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDelegateDeclarationSyntax(DelegateDeclarationSyntax originalNode, DelegateDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.ConstraintClauses, formattedNode.ConstraintClauses, null, o => o.Span, originalNode.Span, formattedNode.Span); @@ -1350,9 +1350,9 @@ private CompareResult CompareDelegateDeclarationSyntax(DelegateDeclarationSyntax formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareDestructorDeclarationSyntax(DestructorDeclarationSyntax originalNode, DestructorDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDestructorDeclarationSyntax(DestructorDeclarationSyntax originalNode, DestructorDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -1372,25 +1372,25 @@ private CompareResult CompareDestructorDeclarationSyntax(DestructorDeclarationSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareDiscardDesignationSyntax(DiscardDesignationSyntax originalNode, DiscardDesignationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDiscardDesignationSyntax(DiscardDesignationSyntax originalNode, DiscardDesignationSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.UnderscoreToken, formattedNode.UnderscoreToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareDiscardPatternSyntax(DiscardPatternSyntax originalNode, DiscardPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDiscardPatternSyntax(DiscardPatternSyntax originalNode, DiscardPatternSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.UnderscoreToken, formattedNode.UnderscoreToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareDocumentationCommentTriviaSyntax(DocumentationCommentTriviaSyntax originalNode, DocumentationCommentTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDocumentationCommentTriviaSyntax(DocumentationCommentTriviaSyntax originalNode, DocumentationCommentTriviaSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Content, formattedNode.Content, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfComment, formattedNode.EndOfComment, originalNode, formattedNode); @@ -1398,9 +1398,9 @@ private CompareResult CompareDocumentationCommentTriviaSyntax(DocumentationComme if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareDoStatementSyntax(DoStatementSyntax originalNode, DoStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareDoStatementSyntax(DoStatementSyntax originalNode, DoStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -1420,9 +1420,9 @@ private CompareResult CompareDoStatementSyntax(DoStatementSyntax originalNode, D if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareElementAccessExpressionSyntax(ElementAccessExpressionSyntax originalNode, ElementAccessExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareElementAccessExpressionSyntax(ElementAccessExpressionSyntax originalNode, ElementAccessExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); originalStack.Push((originalNode.Expression, originalNode)); @@ -1430,17 +1430,17 @@ private CompareResult CompareElementAccessExpressionSyntax(ElementAccessExpressi if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareElementBindingExpressionSyntax(ElementBindingExpressionSyntax originalNode, ElementBindingExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareElementBindingExpressionSyntax(ElementBindingExpressionSyntax originalNode, ElementBindingExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareElifDirectiveTriviaSyntax(ElifDirectiveTriviaSyntax originalNode, ElifDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareElifDirectiveTriviaSyntax(ElifDirectiveTriviaSyntax originalNode, ElifDirectiveTriviaSyntax formattedNode) + { + CompareResult result; if (originalNode.BranchTaken != formattedNode.BranchTaken) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Condition, originalNode)); formattedStack.Push((formattedNode.Condition, formattedNode)); @@ -1457,9 +1457,9 @@ private CompareResult CompareElifDirectiveTriviaSyntax(ElifDirectiveTriviaSyntax if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareElseClauseSyntax(ElseClauseSyntax originalNode, ElseClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareElseClauseSyntax(ElseClauseSyntax originalNode, ElseClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ElseKeyword, formattedNode.ElseKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1467,9 +1467,9 @@ private CompareResult CompareElseClauseSyntax(ElseClauseSyntax originalNode, Els formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareElseDirectiveTriviaSyntax(ElseDirectiveTriviaSyntax originalNode, ElseDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareElseDirectiveTriviaSyntax(ElseDirectiveTriviaSyntax originalNode, ElseDirectiveTriviaSyntax formattedNode) + { + CompareResult result; if (originalNode.BranchTaken != formattedNode.BranchTaken) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -1483,9 +1483,9 @@ private CompareResult CompareElseDirectiveTriviaSyntax(ElseDirectiveTriviaSyntax if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareEmptyStatementSyntax(EmptyStatementSyntax originalNode, EmptyStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEmptyStatementSyntax(EmptyStatementSyntax originalNode, EmptyStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1493,9 +1493,9 @@ private CompareResult CompareEmptyStatementSyntax(EmptyStatementSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareEndIfDirectiveTriviaSyntax(EndIfDirectiveTriviaSyntax originalNode, EndIfDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEndIfDirectiveTriviaSyntax(EndIfDirectiveTriviaSyntax originalNode, EndIfDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndIfKeyword, formattedNode.EndIfKeyword, originalNode, formattedNode); @@ -1508,9 +1508,9 @@ private CompareResult CompareEndIfDirectiveTriviaSyntax(EndIfDirectiveTriviaSynt if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareEndRegionDirectiveTriviaSyntax(EndRegionDirectiveTriviaSyntax originalNode, EndRegionDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEndRegionDirectiveTriviaSyntax(EndRegionDirectiveTriviaSyntax originalNode, EndRegionDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -1523,9 +1523,9 @@ private CompareResult CompareEndRegionDirectiveTriviaSyntax(EndRegionDirectiveTr if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareEnumDeclarationSyntax(EnumDeclarationSyntax originalNode, EnumDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEnumDeclarationSyntax(EnumDeclarationSyntax originalNode, EnumDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.BaseList, originalNode)); @@ -1539,7 +1539,7 @@ private CompareResult CompareEnumDeclarationSyntax(EnumDeclarationSyntax origina if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.Members, formattedNode.Members, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Members.GetSeparators().ToList(), formattedNode.Members.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Members.GetSeparators().Take(originalNode.Members.Count() - 1).ToList(), formattedNode.Members.GetSeparators().Take(formattedNode.Members.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Modifiers.OrderBy(o => o.Text).ToList(), formattedNode.Modifiers.OrderBy(o => o.Text).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; @@ -1549,9 +1549,9 @@ private CompareResult CompareEnumDeclarationSyntax(EnumDeclarationSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareEnumMemberDeclarationSyntax(EnumMemberDeclarationSyntax originalNode, EnumMemberDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEnumMemberDeclarationSyntax(EnumMemberDeclarationSyntax originalNode, EnumMemberDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.EqualsValue, originalNode)); @@ -1563,9 +1563,9 @@ private CompareResult CompareEnumMemberDeclarationSyntax(EnumMemberDeclarationSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareEqualsValueClauseSyntax(EqualsValueClauseSyntax originalNode, EqualsValueClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEqualsValueClauseSyntax(EqualsValueClauseSyntax originalNode, EqualsValueClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EqualsToken, formattedNode.EqualsToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1573,9 +1573,9 @@ private CompareResult CompareEqualsValueClauseSyntax(EqualsValueClauseSyntax ori formattedStack.Push((formattedNode.Value, formattedNode)); return Equal; } - private CompareResult CompareErrorDirectiveTriviaSyntax(ErrorDirectiveTriviaSyntax originalNode, ErrorDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareErrorDirectiveTriviaSyntax(ErrorDirectiveTriviaSyntax originalNode, ErrorDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -1588,9 +1588,9 @@ private CompareResult CompareErrorDirectiveTriviaSyntax(ErrorDirectiveTriviaSynt if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareEventDeclarationSyntax(EventDeclarationSyntax originalNode, EventDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEventDeclarationSyntax(EventDeclarationSyntax originalNode, EventDeclarationSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.AccessorList, originalNode)); formattedStack.Push((formattedNode.AccessorList, formattedNode)); result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); @@ -1610,9 +1610,9 @@ private CompareResult CompareEventDeclarationSyntax(EventDeclarationSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareEventFieldDeclarationSyntax(EventFieldDeclarationSyntax originalNode, EventFieldDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareEventFieldDeclarationSyntax(EventFieldDeclarationSyntax originalNode, EventFieldDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Declaration, originalNode)); @@ -1626,9 +1626,9 @@ private CompareResult CompareEventFieldDeclarationSyntax(EventFieldDeclarationSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareExplicitInterfaceSpecifierSyntax(ExplicitInterfaceSpecifierSyntax originalNode, ExplicitInterfaceSpecifierSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareExplicitInterfaceSpecifierSyntax(ExplicitInterfaceSpecifierSyntax originalNode, ExplicitInterfaceSpecifierSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DotToken, formattedNode.DotToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1636,9 +1636,9 @@ private CompareResult CompareExplicitInterfaceSpecifierSyntax(ExplicitInterfaceS formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareExpressionColonSyntax(ExpressionColonSyntax originalNode, ExpressionColonSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareExpressionColonSyntax(ExpressionColonSyntax originalNode, ExpressionColonSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -1646,17 +1646,17 @@ private CompareResult CompareExpressionColonSyntax(ExpressionColonSyntax origina if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareExpressionElementSyntax(ExpressionElementSyntax originalNode, ExpressionElementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareExpressionElementSyntax(ExpressionElementSyntax originalNode, ExpressionElementSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareExpressionStatementSyntax(ExpressionStatementSyntax originalNode, ExpressionStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareExpressionStatementSyntax(ExpressionStatementSyntax originalNode, ExpressionStatementSyntax formattedNode) + { + CompareResult result; if (originalNode.AllowsAnyExpression != formattedNode.AllowsAnyExpression) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; @@ -1667,9 +1667,9 @@ private CompareResult CompareExpressionStatementSyntax(ExpressionStatementSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareExternAliasDirectiveSyntax(ExternAliasDirectiveSyntax originalNode, ExternAliasDirectiveSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareExternAliasDirectiveSyntax(ExternAliasDirectiveSyntax originalNode, ExternAliasDirectiveSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AliasKeyword, formattedNode.AliasKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.ExternKeyword, formattedNode.ExternKeyword, originalNode, formattedNode); @@ -1681,9 +1681,9 @@ private CompareResult CompareExternAliasDirectiveSyntax(ExternAliasDirectiveSynt if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareFieldDeclarationSyntax(FieldDeclarationSyntax originalNode, FieldDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFieldDeclarationSyntax(FieldDeclarationSyntax originalNode, FieldDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Declaration, originalNode)); @@ -1695,9 +1695,9 @@ private CompareResult CompareFieldDeclarationSyntax(FieldDeclarationSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareFileScopedNamespaceDeclarationSyntax(FileScopedNamespaceDeclarationSyntax originalNode, FileScopedNamespaceDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFileScopedNamespaceDeclarationSyntax(FileScopedNamespaceDeclarationSyntax originalNode, FileScopedNamespaceDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Externs, formattedNode.Externs, null, o => o.Span, originalNode.Span, formattedNode.Span); @@ -1717,9 +1717,9 @@ private CompareResult CompareFileScopedNamespaceDeclarationSyntax(FileScopedName if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareFinallyClauseSyntax(FinallyClauseSyntax originalNode, FinallyClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFinallyClauseSyntax(FinallyClauseSyntax originalNode, FinallyClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Block, originalNode)); formattedStack.Push((formattedNode.Block, formattedNode)); result = this.Compare(originalNode.FinallyKeyword, formattedNode.FinallyKeyword, originalNode, formattedNode); @@ -1727,9 +1727,9 @@ private CompareResult CompareFinallyClauseSyntax(FinallyClauseSyntax originalNod if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareFixedStatementSyntax(FixedStatementSyntax originalNode, FixedStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFixedStatementSyntax(FixedStatementSyntax originalNode, FixedStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -1745,9 +1745,9 @@ private CompareResult CompareFixedStatementSyntax(FixedStatementSyntax originalN formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareForEachStatementSyntax(ForEachStatementSyntax originalNode, ForEachStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareForEachStatementSyntax(ForEachStatementSyntax originalNode, ForEachStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.AwaitKeyword, formattedNode.AwaitKeyword, originalNode, formattedNode); @@ -1771,9 +1771,9 @@ private CompareResult CompareForEachStatementSyntax(ForEachStatementSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareForEachVariableStatementSyntax(ForEachVariableStatementSyntax originalNode, ForEachVariableStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareForEachVariableStatementSyntax(ForEachVariableStatementSyntax originalNode, ForEachVariableStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.AwaitKeyword, formattedNode.AwaitKeyword, originalNode, formattedNode); @@ -1795,9 +1795,9 @@ private CompareResult CompareForEachVariableStatementSyntax(ForEachVariableState formattedStack.Push((formattedNode.Variable, formattedNode)); return Equal; } - private CompareResult CompareForStatementSyntax(ForStatementSyntax originalNode, ForStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareForStatementSyntax(ForStatementSyntax originalNode, ForStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -1812,11 +1812,11 @@ private CompareResult CompareForStatementSyntax(ForStatementSyntax originalNode, if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Incrementors, formattedNode.Incrementors, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Incrementors.GetSeparators().ToList(), formattedNode.Incrementors.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Incrementors.GetSeparators().Take(originalNode.Incrementors.Count() - 1).ToList(), formattedNode.Incrementors.GetSeparators().Take(formattedNode.Incrementors.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Initializers, formattedNode.Initializers, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Initializers.GetSeparators().ToList(), formattedNode.Initializers.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Initializers.GetSeparators().Take(originalNode.Initializers.Count() - 1).ToList(), formattedNode.Initializers.GetSeparators().Take(formattedNode.Initializers.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OpenParenToken, formattedNode.OpenParenToken, originalNode, formattedNode); @@ -1827,9 +1827,9 @@ private CompareResult CompareForStatementSyntax(ForStatementSyntax originalNode, formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareFromClauseSyntax(FromClauseSyntax originalNode, FromClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFromClauseSyntax(FromClauseSyntax originalNode, FromClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); result = this.Compare(originalNode.FromKeyword, formattedNode.FromKeyword, originalNode, formattedNode); @@ -1843,9 +1843,9 @@ private CompareResult CompareFromClauseSyntax(FromClauseSyntax originalNode, Fro formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareFunctionPointerCallingConventionSyntax(FunctionPointerCallingConventionSyntax originalNode, FunctionPointerCallingConventionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerCallingConventionSyntax(FunctionPointerCallingConventionSyntax originalNode, FunctionPointerCallingConventionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.ManagedOrUnmanagedKeyword, formattedNode.ManagedOrUnmanagedKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -1853,9 +1853,9 @@ private CompareResult CompareFunctionPointerCallingConventionSyntax(FunctionPoin formattedStack.Push((formattedNode.UnmanagedCallingConventionList, formattedNode)); return Equal; } - private CompareResult CompareFunctionPointerParameterListSyntax(FunctionPointerParameterListSyntax originalNode, FunctionPointerParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerParameterListSyntax(FunctionPointerParameterListSyntax originalNode, FunctionPointerParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.GreaterThanToken, formattedNode.GreaterThanToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1863,13 +1863,13 @@ private CompareResult CompareFunctionPointerParameterListSyntax(FunctionPointerP if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareFunctionPointerParameterSyntax(FunctionPointerParameterSyntax originalNode, FunctionPointerParameterSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerParameterSyntax(FunctionPointerParameterSyntax originalNode, FunctionPointerParameterSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1879,9 +1879,9 @@ private CompareResult CompareFunctionPointerParameterSyntax(FunctionPointerParam formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareFunctionPointerTypeSyntax(FunctionPointerTypeSyntax originalNode, FunctionPointerTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerTypeSyntax(FunctionPointerTypeSyntax originalNode, FunctionPointerTypeSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AsteriskToken, formattedNode.AsteriskToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.CallingConvention, originalNode)); @@ -1898,12 +1898,12 @@ private CompareResult CompareFunctionPointerTypeSyntax(FunctionPointerTypeSyntax formattedStack.Push((formattedNode.ParameterList, formattedNode)); return Equal; } - private CompareResult CompareFunctionPointerUnmanagedCallingConventionListSyntax(FunctionPointerUnmanagedCallingConventionListSyntax originalNode, FunctionPointerUnmanagedCallingConventionListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerUnmanagedCallingConventionListSyntax(FunctionPointerUnmanagedCallingConventionListSyntax originalNode, FunctionPointerUnmanagedCallingConventionListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.CallingConventions, formattedNode.CallingConventions, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.CallingConventions.GetSeparators().ToList(), formattedNode.CallingConventions.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.CallingConventions.GetSeparators().Take(originalNode.CallingConventions.Count() - 1).ToList(), formattedNode.CallingConventions.GetSeparators().Take(formattedNode.CallingConventions.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -1912,17 +1912,17 @@ private CompareResult CompareFunctionPointerUnmanagedCallingConventionListSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareFunctionPointerUnmanagedCallingConventionSyntax(FunctionPointerUnmanagedCallingConventionSyntax originalNode, FunctionPointerUnmanagedCallingConventionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareFunctionPointerUnmanagedCallingConventionSyntax(FunctionPointerUnmanagedCallingConventionSyntax originalNode, FunctionPointerUnmanagedCallingConventionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.Name, formattedNode.Name, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareGenericNameSyntax(GenericNameSyntax originalNode, GenericNameSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareGenericNameSyntax(GenericNameSyntax originalNode, GenericNameSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1936,9 +1936,9 @@ private CompareResult CompareGenericNameSyntax(GenericNameSyntax originalNode, G formattedStack.Push((formattedNode.TypeArgumentList, formattedNode)); return Equal; } - private CompareResult CompareGlobalStatementSyntax(GlobalStatementSyntax originalNode, GlobalStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareGlobalStatementSyntax(GlobalStatementSyntax originalNode, GlobalStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1948,9 +1948,9 @@ private CompareResult CompareGlobalStatementSyntax(GlobalStatementSyntax origina formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareGotoStatementSyntax(GotoStatementSyntax originalNode, GotoStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareGotoStatementSyntax(GotoStatementSyntax originalNode, GotoStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CaseOrDefaultKeyword, formattedNode.CaseOrDefaultKeyword, originalNode, formattedNode); @@ -1964,9 +1964,9 @@ private CompareResult CompareGotoStatementSyntax(GotoStatementSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareGroupClauseSyntax(GroupClauseSyntax originalNode, GroupClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareGroupClauseSyntax(GroupClauseSyntax originalNode, GroupClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ByExpression, originalNode)); formattedStack.Push((formattedNode.ByExpression, formattedNode)); result = this.Compare(originalNode.ByKeyword, formattedNode.ByKeyword, originalNode, formattedNode); @@ -1978,9 +1978,9 @@ private CompareResult CompareGroupClauseSyntax(GroupClauseSyntax originalNode, G if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareIdentifierNameSyntax(IdentifierNameSyntax originalNode, IdentifierNameSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIdentifierNameSyntax(IdentifierNameSyntax originalNode, IdentifierNameSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -1991,9 +1991,9 @@ private CompareResult CompareIdentifierNameSyntax(IdentifierNameSyntax originalN if (originalNode.IsVar != formattedNode.IsVar) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareIfDirectiveTriviaSyntax(IfDirectiveTriviaSyntax originalNode, IfDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIfDirectiveTriviaSyntax(IfDirectiveTriviaSyntax originalNode, IfDirectiveTriviaSyntax formattedNode) + { + CompareResult result; if (originalNode.BranchTaken != formattedNode.BranchTaken) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Condition, originalNode)); formattedStack.Push((formattedNode.Condition, formattedNode)); @@ -2010,9 +2010,9 @@ private CompareResult CompareIfDirectiveTriviaSyntax(IfDirectiveTriviaSyntax ori if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareIfStatementSyntax(IfStatementSyntax originalNode, IfStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIfStatementSyntax(IfStatementSyntax originalNode, IfStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -2030,9 +2030,9 @@ private CompareResult CompareIfStatementSyntax(IfStatementSyntax originalNode, I formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareImplicitArrayCreationExpressionSyntax(ImplicitArrayCreationExpressionSyntax originalNode, ImplicitArrayCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareImplicitArrayCreationExpressionSyntax(ImplicitArrayCreationExpressionSyntax originalNode, ImplicitArrayCreationExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Commas, formattedNode.Commas, Compare, o => o.Span, originalNode.Span, formattedNode.Span); @@ -2046,17 +2046,17 @@ private CompareResult CompareImplicitArrayCreationExpressionSyntax(ImplicitArray if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareImplicitElementAccessSyntax(ImplicitElementAccessSyntax originalNode, ImplicitElementAccessSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareImplicitElementAccessSyntax(ImplicitElementAccessSyntax originalNode, ImplicitElementAccessSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareImplicitObjectCreationExpressionSyntax(ImplicitObjectCreationExpressionSyntax originalNode, ImplicitObjectCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareImplicitObjectCreationExpressionSyntax(ImplicitObjectCreationExpressionSyntax originalNode, ImplicitObjectCreationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); originalStack.Push((originalNode.Initializer, originalNode)); @@ -2066,9 +2066,9 @@ private CompareResult CompareImplicitObjectCreationExpressionSyntax(ImplicitObje if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareImplicitStackAllocArrayCreationExpressionSyntax(ImplicitStackAllocArrayCreationExpressionSyntax originalNode, ImplicitStackAllocArrayCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareImplicitStackAllocArrayCreationExpressionSyntax(ImplicitStackAllocArrayCreationExpressionSyntax originalNode, ImplicitStackAllocArrayCreationExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Initializer, originalNode)); @@ -2080,9 +2080,9 @@ private CompareResult CompareImplicitStackAllocArrayCreationExpressionSyntax(Imp if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareIncompleteMemberSyntax(IncompleteMemberSyntax originalNode, IncompleteMemberSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIncompleteMemberSyntax(IncompleteMemberSyntax originalNode, IncompleteMemberSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2092,9 +2092,9 @@ private CompareResult CompareIncompleteMemberSyntax(IncompleteMemberSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareIndexerDeclarationSyntax(IndexerDeclarationSyntax originalNode, IndexerDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIndexerDeclarationSyntax(IndexerDeclarationSyntax originalNode, IndexerDeclarationSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.AccessorList, originalNode)); formattedStack.Push((formattedNode.AccessorList, formattedNode)); result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); @@ -2116,9 +2116,9 @@ private CompareResult CompareIndexerDeclarationSyntax(IndexerDeclarationSyntax o formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareIndexerMemberCrefSyntax(IndexerMemberCrefSyntax originalNode, IndexerMemberCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIndexerMemberCrefSyntax(IndexerMemberCrefSyntax originalNode, IndexerMemberCrefSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Parameters, originalNode)); formattedStack.Push((formattedNode.Parameters, formattedNode)); @@ -2126,23 +2126,23 @@ private CompareResult CompareIndexerMemberCrefSyntax(IndexerMemberCrefSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareInitializerExpressionSyntax(InitializerExpressionSyntax originalNode, InitializerExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInitializerExpressionSyntax(InitializerExpressionSyntax originalNode, InitializerExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Expressions, formattedNode.Expressions, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Expressions.GetSeparators().ToList(), formattedNode.Expressions.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Expressions.GetSeparators().Take(originalNode.Expressions.Count() - 1).ToList(), formattedNode.Expressions.GetSeparators().Take(formattedNode.Expressions.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OpenBraceToken, formattedNode.OpenBraceToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareInterfaceDeclarationSyntax(InterfaceDeclarationSyntax originalNode, InterfaceDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterfaceDeclarationSyntax(InterfaceDeclarationSyntax originalNode, InterfaceDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.BaseList, originalNode)); @@ -2170,9 +2170,9 @@ private CompareResult CompareInterfaceDeclarationSyntax(InterfaceDeclarationSynt formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareInterpolatedStringExpressionSyntax(InterpolatedStringExpressionSyntax originalNode, InterpolatedStringExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterpolatedStringExpressionSyntax(InterpolatedStringExpressionSyntax originalNode, InterpolatedStringExpressionSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Contents, formattedNode.Contents, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2182,17 +2182,17 @@ private CompareResult CompareInterpolatedStringExpressionSyntax(InterpolatedStri if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareInterpolatedStringTextSyntax(InterpolatedStringTextSyntax originalNode, InterpolatedStringTextSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterpolatedStringTextSyntax(InterpolatedStringTextSyntax originalNode, InterpolatedStringTextSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.TextToken, formattedNode.TextToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareInterpolationAlignmentClauseSyntax(InterpolationAlignmentClauseSyntax originalNode, InterpolationAlignmentClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterpolationAlignmentClauseSyntax(InterpolationAlignmentClauseSyntax originalNode, InterpolationAlignmentClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CommaToken, formattedNode.CommaToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2200,9 +2200,9 @@ private CompareResult CompareInterpolationAlignmentClauseSyntax(InterpolationAli formattedStack.Push((formattedNode.Value, formattedNode)); return Equal; } - private CompareResult CompareInterpolationFormatClauseSyntax(InterpolationFormatClauseSyntax originalNode, InterpolationFormatClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterpolationFormatClauseSyntax(InterpolationFormatClauseSyntax originalNode, InterpolationFormatClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.FormatStringToken, formattedNode.FormatStringToken, originalNode, formattedNode); @@ -2210,9 +2210,9 @@ private CompareResult CompareInterpolationFormatClauseSyntax(InterpolationFormat if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareInterpolationSyntax(InterpolationSyntax originalNode, InterpolationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInterpolationSyntax(InterpolationSyntax originalNode, InterpolationSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.AlignmentClause, originalNode)); formattedStack.Push((formattedNode.AlignmentClause, formattedNode)); result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); @@ -2226,9 +2226,9 @@ private CompareResult CompareInterpolationSyntax(InterpolationSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareInvocationExpressionSyntax(InvocationExpressionSyntax originalNode, InvocationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareInvocationExpressionSyntax(InvocationExpressionSyntax originalNode, InvocationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); originalStack.Push((originalNode.Expression, originalNode)); @@ -2236,9 +2236,9 @@ private CompareResult CompareInvocationExpressionSyntax(InvocationExpressionSynt if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareIsPatternExpressionSyntax(IsPatternExpressionSyntax originalNode, IsPatternExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareIsPatternExpressionSyntax(IsPatternExpressionSyntax originalNode, IsPatternExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); result = this.Compare(originalNode.IsKeyword, formattedNode.IsKeyword, originalNode, formattedNode); @@ -2248,9 +2248,9 @@ private CompareResult CompareIsPatternExpressionSyntax(IsPatternExpressionSyntax formattedStack.Push((formattedNode.Pattern, formattedNode)); return Equal; } - private CompareResult CompareJoinClauseSyntax(JoinClauseSyntax originalNode, JoinClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareJoinClauseSyntax(JoinClauseSyntax originalNode, JoinClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EqualsKeyword, formattedNode.EqualsKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -2274,9 +2274,9 @@ private CompareResult CompareJoinClauseSyntax(JoinClauseSyntax originalNode, Joi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareJoinIntoClauseSyntax(JoinIntoClauseSyntax originalNode, JoinIntoClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareJoinIntoClauseSyntax(JoinIntoClauseSyntax originalNode, JoinIntoClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.IntoKeyword, formattedNode.IntoKeyword, originalNode, formattedNode); @@ -2284,9 +2284,9 @@ private CompareResult CompareJoinIntoClauseSyntax(JoinIntoClauseSyntax originalN if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareLabeledStatementSyntax(LabeledStatementSyntax originalNode, LabeledStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLabeledStatementSyntax(LabeledStatementSyntax originalNode, LabeledStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); @@ -2298,9 +2298,9 @@ private CompareResult CompareLabeledStatementSyntax(LabeledStatementSyntax origi formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareLetClauseSyntax(LetClauseSyntax originalNode, LetClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLetClauseSyntax(LetClauseSyntax originalNode, LetClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EqualsToken, formattedNode.EqualsToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -2312,9 +2312,9 @@ private CompareResult CompareLetClauseSyntax(LetClauseSyntax originalNode, LetCl if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLineDirectivePositionSyntax(LineDirectivePositionSyntax originalNode, LineDirectivePositionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLineDirectivePositionSyntax(LineDirectivePositionSyntax originalNode, LineDirectivePositionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Character, formattedNode.Character, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -2328,9 +2328,9 @@ private CompareResult CompareLineDirectivePositionSyntax(LineDirectivePositionSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLineDirectiveTriviaSyntax(LineDirectiveTriviaSyntax originalNode, LineDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLineDirectiveTriviaSyntax(LineDirectiveTriviaSyntax originalNode, LineDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -2347,9 +2347,9 @@ private CompareResult CompareLineDirectiveTriviaSyntax(LineDirectiveTriviaSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLineSpanDirectiveTriviaSyntax(LineSpanDirectiveTriviaSyntax originalNode, LineSpanDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLineSpanDirectiveTriviaSyntax(LineSpanDirectiveTriviaSyntax originalNode, LineSpanDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CharacterOffset, formattedNode.CharacterOffset, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); @@ -2372,9 +2372,9 @@ private CompareResult CompareLineSpanDirectiveTriviaSyntax(LineSpanDirectiveTriv formattedStack.Push((formattedNode.Start, formattedNode)); return Equal; } - private CompareResult CompareListPatternSyntax(ListPatternSyntax originalNode, ListPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareListPatternSyntax(ListPatternSyntax originalNode, ListPatternSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBracketToken, formattedNode.CloseBracketToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Designation, originalNode)); @@ -2384,21 +2384,21 @@ private CompareResult CompareListPatternSyntax(ListPatternSyntax originalNode, L if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Patterns, formattedNode.Patterns, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Patterns.GetSeparators().ToList(), formattedNode.Patterns.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Patterns.GetSeparators().Take(originalNode.Patterns.Count() - 1).ToList(), formattedNode.Patterns.GetSeparators().Take(formattedNode.Patterns.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLiteralExpressionSyntax(LiteralExpressionSyntax originalNode, LiteralExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLiteralExpressionSyntax(LiteralExpressionSyntax originalNode, LiteralExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.Token, formattedNode.Token, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLoadDirectiveTriviaSyntax(LoadDirectiveTriviaSyntax originalNode, LoadDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLoadDirectiveTriviaSyntax(LoadDirectiveTriviaSyntax originalNode, LoadDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -2413,9 +2413,9 @@ private CompareResult CompareLoadDirectiveTriviaSyntax(LoadDirectiveTriviaSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLocalDeclarationStatementSyntax(LocalDeclarationStatementSyntax originalNode, LocalDeclarationStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLocalDeclarationStatementSyntax(LocalDeclarationStatementSyntax originalNode, LocalDeclarationStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.AwaitKeyword, formattedNode.AwaitKeyword, originalNode, formattedNode); @@ -2432,9 +2432,9 @@ private CompareResult CompareLocalDeclarationStatementSyntax(LocalDeclarationSta if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareLocalFunctionStatementSyntax(LocalFunctionStatementSyntax originalNode, LocalFunctionStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLocalFunctionStatementSyntax(LocalFunctionStatementSyntax originalNode, LocalFunctionStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -2458,9 +2458,9 @@ private CompareResult CompareLocalFunctionStatementSyntax(LocalFunctionStatement formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareLockStatementSyntax(LockStatementSyntax originalNode, LockStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareLockStatementSyntax(LockStatementSyntax originalNode, LockStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -2476,9 +2476,9 @@ private CompareResult CompareLockStatementSyntax(LockStatementSyntax originalNod formattedStack.Push((formattedNode.Statement, formattedNode)); return Equal; } - private CompareResult CompareMakeRefExpressionSyntax(MakeRefExpressionSyntax originalNode, MakeRefExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareMakeRefExpressionSyntax(MakeRefExpressionSyntax originalNode, MakeRefExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -2490,9 +2490,9 @@ private CompareResult CompareMakeRefExpressionSyntax(MakeRefExpressionSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareMemberAccessExpressionSyntax(MemberAccessExpressionSyntax originalNode, MemberAccessExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareMemberAccessExpressionSyntax(MemberAccessExpressionSyntax originalNode, MemberAccessExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2502,9 +2502,9 @@ private CompareResult CompareMemberAccessExpressionSyntax(MemberAccessExpression if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareMemberBindingExpressionSyntax(MemberBindingExpressionSyntax originalNode, MemberBindingExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareMemberBindingExpressionSyntax(MemberBindingExpressionSyntax originalNode, MemberBindingExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Name, originalNode)); formattedStack.Push((formattedNode.Name, formattedNode)); @@ -2512,9 +2512,9 @@ private CompareResult CompareMemberBindingExpressionSyntax(MemberBindingExpressi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareMethodDeclarationSyntax(MethodDeclarationSyntax originalNode, MethodDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareMethodDeclarationSyntax(MethodDeclarationSyntax originalNode, MethodDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -2540,9 +2540,9 @@ private CompareResult CompareMethodDeclarationSyntax(MethodDeclarationSyntax ori formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareNameColonSyntax(NameColonSyntax originalNode, NameColonSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNameColonSyntax(NameColonSyntax originalNode, NameColonSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -2552,9 +2552,9 @@ private CompareResult CompareNameColonSyntax(NameColonSyntax originalNode, NameC formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareNameEqualsSyntax(NameEqualsSyntax originalNode, NameEqualsSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNameEqualsSyntax(NameEqualsSyntax originalNode, NameEqualsSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EqualsToken, formattedNode.EqualsToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2562,9 +2562,9 @@ private CompareResult CompareNameEqualsSyntax(NameEqualsSyntax originalNode, Nam formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareNameMemberCrefSyntax(NameMemberCrefSyntax originalNode, NameMemberCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNameMemberCrefSyntax(NameMemberCrefSyntax originalNode, NameMemberCrefSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Name, originalNode)); formattedStack.Push((formattedNode.Name, formattedNode)); @@ -2572,9 +2572,9 @@ private CompareResult CompareNameMemberCrefSyntax(NameMemberCrefSyntax originalN formattedStack.Push((formattedNode.Parameters, formattedNode)); return Equal; } - private CompareResult CompareNamespaceDeclarationSyntax(NamespaceDeclarationSyntax originalNode, NamespaceDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNamespaceDeclarationSyntax(NamespaceDeclarationSyntax originalNode, NamespaceDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); @@ -2598,9 +2598,9 @@ private CompareResult CompareNamespaceDeclarationSyntax(NamespaceDeclarationSynt if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareNullableDirectiveTriviaSyntax(NullableDirectiveTriviaSyntax originalNode, NullableDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNullableDirectiveTriviaSyntax(NullableDirectiveTriviaSyntax originalNode, NullableDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -2617,9 +2617,9 @@ private CompareResult CompareNullableDirectiveTriviaSyntax(NullableDirectiveTriv if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareNullableTypeSyntax(NullableTypeSyntax originalNode, NullableTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareNullableTypeSyntax(NullableTypeSyntax originalNode, NullableTypeSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ElementType, originalNode)); formattedStack.Push((formattedNode.ElementType, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2632,9 +2632,9 @@ private CompareResult CompareNullableTypeSyntax(NullableTypeSyntax originalNode, if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareObjectCreationExpressionSyntax(ObjectCreationExpressionSyntax originalNode, ObjectCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareObjectCreationExpressionSyntax(ObjectCreationExpressionSyntax originalNode, ObjectCreationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); originalStack.Push((originalNode.Initializer, originalNode)); @@ -2646,17 +2646,17 @@ private CompareResult CompareObjectCreationExpressionSyntax(ObjectCreationExpres formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareOmittedArraySizeExpressionSyntax(OmittedArraySizeExpressionSyntax originalNode, OmittedArraySizeExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOmittedArraySizeExpressionSyntax(OmittedArraySizeExpressionSyntax originalNode, OmittedArraySizeExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OmittedArraySizeExpressionToken, formattedNode.OmittedArraySizeExpressionToken, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareOmittedTypeArgumentSyntax(OmittedTypeArgumentSyntax originalNode, OmittedTypeArgumentSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOmittedTypeArgumentSyntax(OmittedTypeArgumentSyntax originalNode, OmittedTypeArgumentSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); if (originalNode.IsNint != formattedNode.IsNint) return NotEqual(originalNode, formattedNode); if (originalNode.IsNotNull != formattedNode.IsNotNull) return NotEqual(originalNode, formattedNode); @@ -2667,9 +2667,9 @@ private CompareResult CompareOmittedTypeArgumentSyntax(OmittedTypeArgumentSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareOperatorDeclarationSyntax(OperatorDeclarationSyntax originalNode, OperatorDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOperatorDeclarationSyntax(OperatorDeclarationSyntax originalNode, OperatorDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Body, originalNode)); @@ -2695,9 +2695,9 @@ private CompareResult CompareOperatorDeclarationSyntax(OperatorDeclarationSyntax if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareOperatorMemberCrefSyntax(OperatorMemberCrefSyntax originalNode, OperatorMemberCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOperatorMemberCrefSyntax(OperatorMemberCrefSyntax originalNode, OperatorMemberCrefSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CheckedKeyword, formattedNode.CheckedKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2709,21 +2709,21 @@ private CompareResult CompareOperatorMemberCrefSyntax(OperatorMemberCrefSyntax o formattedStack.Push((formattedNode.Parameters, formattedNode)); return Equal; } - private CompareResult CompareOrderByClauseSyntax(OrderByClauseSyntax originalNode, OrderByClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOrderByClauseSyntax(OrderByClauseSyntax originalNode, OrderByClauseSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OrderByKeyword, formattedNode.OrderByKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Orderings, formattedNode.Orderings, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Orderings.GetSeparators().ToList(), formattedNode.Orderings.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Orderings.GetSeparators().Take(originalNode.Orderings.Count() - 1).ToList(), formattedNode.Orderings.GetSeparators().Take(formattedNode.Orderings.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareOrderingSyntax(OrderingSyntax originalNode, OrderingSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareOrderingSyntax(OrderingSyntax originalNode, OrderingSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AscendingOrDescendingKeyword, formattedNode.AscendingOrDescendingKeyword, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -2731,9 +2731,9 @@ private CompareResult CompareOrderingSyntax(OrderingSyntax originalNode, Orderin if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareParameterListSyntax(ParameterListSyntax originalNode, ParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParameterListSyntax(ParameterListSyntax originalNode, ParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2741,13 +2741,13 @@ private CompareResult CompareParameterListSyntax(ParameterListSyntax originalNod if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareParameterSyntax(ParameterSyntax originalNode, ParameterSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParameterSyntax(ParameterSyntax originalNode, ParameterSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Default, originalNode)); @@ -2761,9 +2761,9 @@ private CompareResult CompareParameterSyntax(ParameterSyntax originalNode, Param formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareParenthesizedExpressionSyntax(ParenthesizedExpressionSyntax originalNode, ParenthesizedExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParenthesizedExpressionSyntax(ParenthesizedExpressionSyntax originalNode, ParenthesizedExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -2773,9 +2773,9 @@ private CompareResult CompareParenthesizedExpressionSyntax(ParenthesizedExpressi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareParenthesizedLambdaExpressionSyntax(ParenthesizedLambdaExpressionSyntax originalNode, ParenthesizedLambdaExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParenthesizedLambdaExpressionSyntax(ParenthesizedLambdaExpressionSyntax originalNode, ParenthesizedLambdaExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ArrowToken, formattedNode.ArrowToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.AsyncKeyword, formattedNode.AsyncKeyword, originalNode, formattedNode); @@ -2797,9 +2797,9 @@ private CompareResult CompareParenthesizedLambdaExpressionSyntax(ParenthesizedLa formattedStack.Push((formattedNode.ReturnType, formattedNode)); return Equal; } - private CompareResult CompareParenthesizedPatternSyntax(ParenthesizedPatternSyntax originalNode, ParenthesizedPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParenthesizedPatternSyntax(ParenthesizedPatternSyntax originalNode, ParenthesizedPatternSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2809,9 +2809,9 @@ private CompareResult CompareParenthesizedPatternSyntax(ParenthesizedPatternSynt formattedStack.Push((formattedNode.Pattern, formattedNode)); return Equal; } - private CompareResult CompareParenthesizedVariableDesignationSyntax(ParenthesizedVariableDesignationSyntax originalNode, ParenthesizedVariableDesignationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareParenthesizedVariableDesignationSyntax(ParenthesizedVariableDesignationSyntax originalNode, ParenthesizedVariableDesignationSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2819,13 +2819,13 @@ private CompareResult CompareParenthesizedVariableDesignationSyntax(Parenthesize if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Variables, formattedNode.Variables, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Variables.GetSeparators().ToList(), formattedNode.Variables.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Variables.GetSeparators().Take(originalNode.Variables.Count() - 1).ToList(), formattedNode.Variables.GetSeparators().Take(formattedNode.Variables.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePointerTypeSyntax(PointerTypeSyntax originalNode, PointerTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePointerTypeSyntax(PointerTypeSyntax originalNode, PointerTypeSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.AsteriskToken, formattedNode.AsteriskToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.ElementType, originalNode)); @@ -2838,9 +2838,9 @@ private CompareResult ComparePointerTypeSyntax(PointerTypeSyntax originalNode, P if (originalNode.IsVar != formattedNode.IsVar) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult ComparePositionalPatternClauseSyntax(PositionalPatternClauseSyntax originalNode, PositionalPatternClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePositionalPatternClauseSyntax(PositionalPatternClauseSyntax originalNode, PositionalPatternClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2848,13 +2848,13 @@ private CompareResult ComparePositionalPatternClauseSyntax(PositionalPatternClau if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Subpatterns, formattedNode.Subpatterns, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Subpatterns.GetSeparators().ToList(), formattedNode.Subpatterns.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Subpatterns.GetSeparators().Take(originalNode.Subpatterns.Count() - 1).ToList(), formattedNode.Subpatterns.GetSeparators().Take(formattedNode.Subpatterns.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePostfixUnaryExpressionSyntax(PostfixUnaryExpressionSyntax originalNode, PostfixUnaryExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePostfixUnaryExpressionSyntax(PostfixUnaryExpressionSyntax originalNode, PostfixUnaryExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Operand, originalNode)); formattedStack.Push((formattedNode.Operand, formattedNode)); @@ -2862,9 +2862,9 @@ private CompareResult ComparePostfixUnaryExpressionSyntax(PostfixUnaryExpression if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePragmaChecksumDirectiveTriviaSyntax(PragmaChecksumDirectiveTriviaSyntax originalNode, PragmaChecksumDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePragmaChecksumDirectiveTriviaSyntax(PragmaChecksumDirectiveTriviaSyntax originalNode, PragmaChecksumDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Bytes, formattedNode.Bytes, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.ChecksumKeyword, formattedNode.ChecksumKeyword, originalNode, formattedNode); @@ -2885,9 +2885,9 @@ private CompareResult ComparePragmaChecksumDirectiveTriviaSyntax(PragmaChecksumD if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePragmaWarningDirectiveTriviaSyntax(PragmaWarningDirectiveTriviaSyntax originalNode, PragmaWarningDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePragmaWarningDirectiveTriviaSyntax(PragmaWarningDirectiveTriviaSyntax originalNode, PragmaWarningDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.DisableOrRestoreKeyword, formattedNode.DisableOrRestoreKeyword, originalNode, formattedNode); @@ -2896,7 +2896,7 @@ private CompareResult ComparePragmaWarningDirectiveTriviaSyntax(PragmaWarningDir if (result.IsInvalid) return result; result = this.CompareLists(originalNode.ErrorCodes, formattedNode.ErrorCodes, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.ErrorCodes.GetSeparators().ToList(), formattedNode.ErrorCodes.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.ErrorCodes.GetSeparators().Take(originalNode.ErrorCodes.Count() - 1).ToList(), formattedNode.ErrorCodes.GetSeparators().Take(formattedNode.ErrorCodes.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.HashToken, formattedNode.HashToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -2908,9 +2908,9 @@ private CompareResult ComparePragmaWarningDirectiveTriviaSyntax(PragmaWarningDir if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePredefinedTypeSyntax(PredefinedTypeSyntax originalNode, PredefinedTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePredefinedTypeSyntax(PredefinedTypeSyntax originalNode, PredefinedTypeSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); if (originalNode.IsNint != formattedNode.IsNint) return NotEqual(originalNode, formattedNode); if (originalNode.IsNotNull != formattedNode.IsNotNull) return NotEqual(originalNode, formattedNode); @@ -2921,9 +2921,9 @@ private CompareResult ComparePredefinedTypeSyntax(PredefinedTypeSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePrefixUnaryExpressionSyntax(PrefixUnaryExpressionSyntax originalNode, PrefixUnaryExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePrefixUnaryExpressionSyntax(PrefixUnaryExpressionSyntax originalNode, PrefixUnaryExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Operand, originalNode)); formattedStack.Push((formattedNode.Operand, formattedNode)); @@ -2931,9 +2931,9 @@ private CompareResult ComparePrefixUnaryExpressionSyntax(PrefixUnaryExpressionSy if (result.IsInvalid) return result; return Equal; } - private CompareResult ComparePrimaryConstructorBaseTypeSyntax(PrimaryConstructorBaseTypeSyntax originalNode, PrimaryConstructorBaseTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePrimaryConstructorBaseTypeSyntax(PrimaryConstructorBaseTypeSyntax originalNode, PrimaryConstructorBaseTypeSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2941,9 +2941,9 @@ private CompareResult ComparePrimaryConstructorBaseTypeSyntax(PrimaryConstructor formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult ComparePropertyDeclarationSyntax(PropertyDeclarationSyntax originalNode, PropertyDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePropertyDeclarationSyntax(PropertyDeclarationSyntax originalNode, PropertyDeclarationSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.AccessorList, originalNode)); formattedStack.Push((formattedNode.AccessorList, formattedNode)); result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); @@ -2965,9 +2965,9 @@ private CompareResult ComparePropertyDeclarationSyntax(PropertyDeclarationSyntax formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult ComparePropertyPatternClauseSyntax(PropertyPatternClauseSyntax originalNode, PropertyPatternClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult ComparePropertyPatternClauseSyntax(PropertyPatternClauseSyntax originalNode, PropertyPatternClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -2975,13 +2975,13 @@ private CompareResult ComparePropertyPatternClauseSyntax(PropertyPatternClauseSy if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Subpatterns, formattedNode.Subpatterns, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Subpatterns.GetSeparators().ToList(), formattedNode.Subpatterns.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Subpatterns.GetSeparators().Take(originalNode.Subpatterns.Count() - 1).ToList(), formattedNode.Subpatterns.GetSeparators().Take(formattedNode.Subpatterns.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareQualifiedCrefSyntax(QualifiedCrefSyntax originalNode, QualifiedCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareQualifiedCrefSyntax(QualifiedCrefSyntax originalNode, QualifiedCrefSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Container, originalNode)); formattedStack.Push((formattedNode.Container, formattedNode)); result = this.Compare(originalNode.DotToken, formattedNode.DotToken, originalNode, formattedNode); @@ -2991,9 +2991,9 @@ private CompareResult CompareQualifiedCrefSyntax(QualifiedCrefSyntax originalNod formattedStack.Push((formattedNode.Member, formattedNode)); return Equal; } - private CompareResult CompareQualifiedNameSyntax(QualifiedNameSyntax originalNode, QualifiedNameSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareQualifiedNameSyntax(QualifiedNameSyntax originalNode, QualifiedNameSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DotToken, formattedNode.DotToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3008,9 +3008,9 @@ private CompareResult CompareQualifiedNameSyntax(QualifiedNameSyntax originalNod formattedStack.Push((formattedNode.Right, formattedNode)); return Equal; } - private CompareResult CompareQueryBodySyntax(QueryBodySyntax originalNode, QueryBodySyntax formattedNode) - { - CompareResult result; + private CompareResult CompareQueryBodySyntax(QueryBodySyntax originalNode, QueryBodySyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Clauses, formattedNode.Clauses, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Continuation, originalNode)); @@ -3020,9 +3020,9 @@ private CompareResult CompareQueryBodySyntax(QueryBodySyntax originalNode, Query formattedStack.Push((formattedNode.SelectOrGroup, formattedNode)); return Equal; } - private CompareResult CompareQueryContinuationSyntax(QueryContinuationSyntax originalNode, QueryContinuationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareQueryContinuationSyntax(QueryContinuationSyntax originalNode, QueryContinuationSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Body, originalNode)); formattedStack.Push((formattedNode.Body, formattedNode)); result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -3032,9 +3032,9 @@ private CompareResult CompareQueryContinuationSyntax(QueryContinuationSyntax ori if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareQueryExpressionSyntax(QueryExpressionSyntax originalNode, QueryExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareQueryExpressionSyntax(QueryExpressionSyntax originalNode, QueryExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Body, originalNode)); formattedStack.Push((formattedNode.Body, formattedNode)); originalStack.Push((originalNode.FromClause, originalNode)); @@ -3042,9 +3042,9 @@ private CompareResult CompareQueryExpressionSyntax(QueryExpressionSyntax origina if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareRangeExpressionSyntax(RangeExpressionSyntax originalNode, RangeExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRangeExpressionSyntax(RangeExpressionSyntax originalNode, RangeExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.LeftOperand, originalNode)); formattedStack.Push((formattedNode.LeftOperand, formattedNode)); @@ -3054,9 +3054,9 @@ private CompareResult CompareRangeExpressionSyntax(RangeExpressionSyntax origina formattedStack.Push((formattedNode.RightOperand, formattedNode)); return Equal; } - private CompareResult CompareRecordDeclarationSyntax(RecordDeclarationSyntax originalNode, RecordDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRecordDeclarationSyntax(RecordDeclarationSyntax originalNode, RecordDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.BaseList, originalNode)); @@ -3086,9 +3086,9 @@ private CompareResult CompareRecordDeclarationSyntax(RecordDeclarationSyntax ori formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareRecursivePatternSyntax(RecursivePatternSyntax originalNode, RecursivePatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRecursivePatternSyntax(RecursivePatternSyntax originalNode, RecursivePatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Designation, originalNode)); formattedStack.Push((formattedNode.Designation, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3100,9 +3100,9 @@ private CompareResult CompareRecursivePatternSyntax(RecursivePatternSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareReferenceDirectiveTriviaSyntax(ReferenceDirectiveTriviaSyntax originalNode, ReferenceDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareReferenceDirectiveTriviaSyntax(ReferenceDirectiveTriviaSyntax originalNode, ReferenceDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -3117,9 +3117,9 @@ private CompareResult CompareReferenceDirectiveTriviaSyntax(ReferenceDirectiveTr if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareRefExpressionSyntax(RefExpressionSyntax originalNode, RefExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRefExpressionSyntax(RefExpressionSyntax originalNode, RefExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3127,9 +3127,9 @@ private CompareResult CompareRefExpressionSyntax(RefExpressionSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareRefTypeExpressionSyntax(RefTypeExpressionSyntax originalNode, RefTypeExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRefTypeExpressionSyntax(RefTypeExpressionSyntax originalNode, RefTypeExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -3141,9 +3141,9 @@ private CompareResult CompareRefTypeExpressionSyntax(RefTypeExpressionSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareRefTypeSyntax(RefTypeSyntax originalNode, RefTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRefTypeSyntax(RefTypeSyntax originalNode, RefTypeSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); if (originalNode.IsNint != formattedNode.IsNint) return NotEqual(originalNode, formattedNode); if (originalNode.IsNotNull != formattedNode.IsNotNull) return NotEqual(originalNode, formattedNode); @@ -3158,9 +3158,9 @@ private CompareResult CompareRefTypeSyntax(RefTypeSyntax originalNode, RefTypeSy formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareRefValueExpressionSyntax(RefValueExpressionSyntax originalNode, RefValueExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRefValueExpressionSyntax(RefValueExpressionSyntax originalNode, RefValueExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.Comma, formattedNode.Comma, originalNode, formattedNode); @@ -3176,9 +3176,9 @@ private CompareResult CompareRefValueExpressionSyntax(RefValueExpressionSyntax o formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareRegionDirectiveTriviaSyntax(RegionDirectiveTriviaSyntax originalNode, RegionDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRegionDirectiveTriviaSyntax(RegionDirectiveTriviaSyntax originalNode, RegionDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -3191,9 +3191,9 @@ private CompareResult CompareRegionDirectiveTriviaSyntax(RegionDirectiveTriviaSy if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareRelationalPatternSyntax(RelationalPatternSyntax originalNode, RelationalPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareRelationalPatternSyntax(RelationalPatternSyntax originalNode, RelationalPatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3201,9 +3201,9 @@ private CompareResult CompareRelationalPatternSyntax(RelationalPatternSyntax ori if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareReturnStatementSyntax(ReturnStatementSyntax originalNode, ReturnStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareReturnStatementSyntax(ReturnStatementSyntax originalNode, ReturnStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -3215,9 +3215,9 @@ private CompareResult CompareReturnStatementSyntax(ReturnStatementSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareScopedTypeSyntax(ScopedTypeSyntax originalNode, ScopedTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareScopedTypeSyntax(ScopedTypeSyntax originalNode, ScopedTypeSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); if (originalNode.IsNint != formattedNode.IsNint) return NotEqual(originalNode, formattedNode); if (originalNode.IsNotNull != formattedNode.IsNotNull) return NotEqual(originalNode, formattedNode); @@ -3230,9 +3230,9 @@ private CompareResult CompareScopedTypeSyntax(ScopedTypeSyntax originalNode, Sco formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareSelectClauseSyntax(SelectClauseSyntax originalNode, SelectClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSelectClauseSyntax(SelectClauseSyntax originalNode, SelectClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3240,9 +3240,9 @@ private CompareResult CompareSelectClauseSyntax(SelectClauseSyntax originalNode, if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareShebangDirectiveTriviaSyntax(ShebangDirectiveTriviaSyntax originalNode, ShebangDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareShebangDirectiveTriviaSyntax(ShebangDirectiveTriviaSyntax originalNode, ShebangDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -3255,17 +3255,17 @@ private CompareResult CompareShebangDirectiveTriviaSyntax(ShebangDirectiveTrivia if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareSimpleBaseTypeSyntax(SimpleBaseTypeSyntax originalNode, SimpleBaseTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSimpleBaseTypeSyntax(SimpleBaseTypeSyntax originalNode, SimpleBaseTypeSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Type, originalNode)); formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareSimpleLambdaExpressionSyntax(SimpleLambdaExpressionSyntax originalNode, SimpleLambdaExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSimpleLambdaExpressionSyntax(SimpleLambdaExpressionSyntax originalNode, SimpleLambdaExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ArrowToken, formattedNode.ArrowToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.AsyncKeyword, formattedNode.AsyncKeyword, originalNode, formattedNode); @@ -3285,17 +3285,17 @@ private CompareResult CompareSimpleLambdaExpressionSyntax(SimpleLambdaExpression formattedStack.Push((formattedNode.Parameter, formattedNode)); return Equal; } - private CompareResult CompareSingleVariableDesignationSyntax(SingleVariableDesignationSyntax originalNode, SingleVariableDesignationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSingleVariableDesignationSyntax(SingleVariableDesignationSyntax originalNode, SingleVariableDesignationSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareSizeOfExpressionSyntax(SizeOfExpressionSyntax originalNode, SizeOfExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSizeOfExpressionSyntax(SizeOfExpressionSyntax originalNode, SizeOfExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3307,17 +3307,17 @@ private CompareResult CompareSizeOfExpressionSyntax(SizeOfExpressionSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareSkippedTokensTriviaSyntax(SkippedTokensTriviaSyntax originalNode, SkippedTokensTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSkippedTokensTriviaSyntax(SkippedTokensTriviaSyntax originalNode, SkippedTokensTriviaSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.Tokens, formattedNode.Tokens, Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareSlicePatternSyntax(SlicePatternSyntax originalNode, SlicePatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSlicePatternSyntax(SlicePatternSyntax originalNode, SlicePatternSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DotDotToken, formattedNode.DotDotToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3325,9 +3325,9 @@ private CompareResult CompareSlicePatternSyntax(SlicePatternSyntax originalNode, formattedStack.Push((formattedNode.Pattern, formattedNode)); return Equal; } - private CompareResult CompareSpreadElementSyntax(SpreadElementSyntax originalNode, SpreadElementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSpreadElementSyntax(SpreadElementSyntax originalNode, SpreadElementSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3335,9 +3335,9 @@ private CompareResult CompareSpreadElementSyntax(SpreadElementSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareStackAllocArrayCreationExpressionSyntax(StackAllocArrayCreationExpressionSyntax originalNode, StackAllocArrayCreationExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareStackAllocArrayCreationExpressionSyntax(StackAllocArrayCreationExpressionSyntax originalNode, StackAllocArrayCreationExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Initializer, originalNode)); formattedStack.Push((formattedNode.Initializer, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3347,9 +3347,9 @@ private CompareResult CompareStackAllocArrayCreationExpressionSyntax(StackAllocA formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareStructDeclarationSyntax(StructDeclarationSyntax originalNode, StructDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareStructDeclarationSyntax(StructDeclarationSyntax originalNode, StructDeclarationSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.BaseList, originalNode)); @@ -3377,9 +3377,9 @@ private CompareResult CompareStructDeclarationSyntax(StructDeclarationSyntax ori formattedStack.Push((formattedNode.TypeParameterList, formattedNode)); return Equal; } - private CompareResult CompareSubpatternSyntax(SubpatternSyntax originalNode, SubpatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSubpatternSyntax(SubpatternSyntax originalNode, SubpatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ExpressionColon, originalNode)); formattedStack.Push((formattedNode.ExpressionColon, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3389,9 +3389,9 @@ private CompareResult CompareSubpatternSyntax(SubpatternSyntax originalNode, Sub formattedStack.Push((formattedNode.Pattern, formattedNode)); return Equal; } - private CompareResult CompareSwitchExpressionArmSyntax(SwitchExpressionArmSyntax originalNode, SwitchExpressionArmSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSwitchExpressionArmSyntax(SwitchExpressionArmSyntax originalNode, SwitchExpressionArmSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EqualsGreaterThanToken, formattedNode.EqualsGreaterThanToken, originalNode, formattedNode); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -3403,12 +3403,12 @@ private CompareResult CompareSwitchExpressionArmSyntax(SwitchExpressionArmSyntax formattedStack.Push((formattedNode.WhenClause, formattedNode)); return Equal; } - private CompareResult CompareSwitchExpressionSyntax(SwitchExpressionSyntax originalNode, SwitchExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSwitchExpressionSyntax(SwitchExpressionSyntax originalNode, SwitchExpressionSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arms, formattedNode.Arms, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arms.GetSeparators().ToList(), formattedNode.Arms.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arms.GetSeparators().Take(originalNode.Arms.Count() - 1).ToList(), formattedNode.Arms.GetSeparators().Take(formattedNode.Arms.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3421,9 +3421,9 @@ private CompareResult CompareSwitchExpressionSyntax(SwitchExpressionSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareSwitchSectionSyntax(SwitchSectionSyntax originalNode, SwitchSectionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSwitchSectionSyntax(SwitchSectionSyntax originalNode, SwitchSectionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.Labels, formattedNode.Labels, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; @@ -3431,9 +3431,9 @@ private CompareResult CompareSwitchSectionSyntax(SwitchSectionSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareSwitchStatementSyntax(SwitchStatementSyntax originalNode, SwitchStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareSwitchStatementSyntax(SwitchStatementSyntax originalNode, SwitchStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseBraceToken, formattedNode.CloseBraceToken, originalNode, formattedNode); @@ -3453,17 +3453,17 @@ private CompareResult CompareSwitchStatementSyntax(SwitchStatementSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareThisExpressionSyntax(ThisExpressionSyntax originalNode, ThisExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareThisExpressionSyntax(ThisExpressionSyntax originalNode, ThisExpressionSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.Token, formattedNode.Token, originalNode, formattedNode); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareThrowExpressionSyntax(ThrowExpressionSyntax originalNode, ThrowExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareThrowExpressionSyntax(ThrowExpressionSyntax originalNode, ThrowExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3471,9 +3471,9 @@ private CompareResult CompareThrowExpressionSyntax(ThrowExpressionSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareThrowStatementSyntax(ThrowStatementSyntax originalNode, ThrowStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareThrowStatementSyntax(ThrowStatementSyntax originalNode, ThrowStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); @@ -3485,9 +3485,9 @@ private CompareResult CompareThrowStatementSyntax(ThrowStatementSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTryStatementSyntax(TryStatementSyntax originalNode, TryStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTryStatementSyntax(TryStatementSyntax originalNode, TryStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Block, originalNode)); @@ -3501,9 +3501,9 @@ private CompareResult CompareTryStatementSyntax(TryStatementSyntax originalNode, if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTupleElementSyntax(TupleElementSyntax originalNode, TupleElementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTupleElementSyntax(TupleElementSyntax originalNode, TupleElementSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3511,12 +3511,12 @@ private CompareResult CompareTupleElementSyntax(TupleElementSyntax originalNode, formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareTupleExpressionSyntax(TupleExpressionSyntax originalNode, TupleExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTupleExpressionSyntax(TupleExpressionSyntax originalNode, TupleExpressionSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arguments, formattedNode.Arguments, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arguments.GetSeparators().ToList(), formattedNode.Arguments.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arguments.GetSeparators().Take(originalNode.Arguments.Count() - 1).ToList(), formattedNode.Arguments.GetSeparators().Take(formattedNode.Arguments.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3525,14 +3525,14 @@ private CompareResult CompareTupleExpressionSyntax(TupleExpressionSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTupleTypeSyntax(TupleTypeSyntax originalNode, TupleTypeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTupleTypeSyntax(TupleTypeSyntax originalNode, TupleTypeSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Elements, formattedNode.Elements, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Elements.GetSeparators().ToList(), formattedNode.Elements.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Elements.GetSeparators().Take(originalNode.Elements.Count() - 1).ToList(), formattedNode.Elements.GetSeparators().Take(formattedNode.Elements.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); if (originalNode.IsNint != formattedNode.IsNint) return NotEqual(originalNode, formattedNode); @@ -3544,12 +3544,12 @@ private CompareResult CompareTupleTypeSyntax(TupleTypeSyntax originalNode, Tuple if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTypeArgumentListSyntax(TypeArgumentListSyntax originalNode, TypeArgumentListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeArgumentListSyntax(TypeArgumentListSyntax originalNode, TypeArgumentListSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Arguments, formattedNode.Arguments, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Arguments.GetSeparators().ToList(), formattedNode.Arguments.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Arguments.GetSeparators().Take(originalNode.Arguments.Count() - 1).ToList(), formattedNode.Arguments.GetSeparators().Take(formattedNode.Arguments.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.GreaterThanToken, formattedNode.GreaterThanToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3558,25 +3558,25 @@ private CompareResult CompareTypeArgumentListSyntax(TypeArgumentListSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTypeConstraintSyntax(TypeConstraintSyntax originalNode, TypeConstraintSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeConstraintSyntax(TypeConstraintSyntax originalNode, TypeConstraintSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Type, originalNode)); formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareTypeCrefSyntax(TypeCrefSyntax originalNode, TypeCrefSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeCrefSyntax(TypeCrefSyntax originalNode, TypeCrefSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Type, originalNode)); formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareTypeOfExpressionSyntax(TypeOfExpressionSyntax originalNode, TypeOfExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeOfExpressionSyntax(TypeOfExpressionSyntax originalNode, TypeOfExpressionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3588,14 +3588,14 @@ private CompareResult CompareTypeOfExpressionSyntax(TypeOfExpressionSyntax origi formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareTypeParameterConstraintClauseSyntax(TypeParameterConstraintClauseSyntax originalNode, TypeParameterConstraintClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeParameterConstraintClauseSyntax(TypeParameterConstraintClauseSyntax originalNode, TypeParameterConstraintClauseSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Constraints, formattedNode.Constraints, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Constraints.GetSeparators().ToList(), formattedNode.Constraints.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Constraints.GetSeparators().Take(originalNode.Constraints.Count() - 1).ToList(), formattedNode.Constraints.GetSeparators().Take(formattedNode.Constraints.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Name, originalNode)); @@ -3604,9 +3604,9 @@ private CompareResult CompareTypeParameterConstraintClauseSyntax(TypeParameterCo if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTypeParameterListSyntax(TypeParameterListSyntax originalNode, TypeParameterListSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeParameterListSyntax(TypeParameterListSyntax originalNode, TypeParameterListSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.GreaterThanToken, formattedNode.GreaterThanToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3614,13 +3614,13 @@ private CompareResult CompareTypeParameterListSyntax(TypeParameterListSyntax ori if (result.IsInvalid) return result; result = this.CompareLists(originalNode.Parameters, formattedNode.Parameters, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Parameters.GetSeparators().ToList(), formattedNode.Parameters.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Parameters.GetSeparators().Take(originalNode.Parameters.Count() - 1).ToList(), formattedNode.Parameters.GetSeparators().Take(formattedNode.Parameters.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTypeParameterSyntax(TypeParameterSyntax originalNode, TypeParameterSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypeParameterSyntax(TypeParameterSyntax originalNode, TypeParameterSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -3630,17 +3630,17 @@ private CompareResult CompareTypeParameterSyntax(TypeParameterSyntax originalNod if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareTypePatternSyntax(TypePatternSyntax originalNode, TypePatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareTypePatternSyntax(TypePatternSyntax originalNode, TypePatternSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Type, originalNode)); formattedStack.Push((formattedNode.Type, formattedNode)); return Equal; } - private CompareResult CompareUnaryPatternSyntax(UnaryPatternSyntax originalNode, UnaryPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareUnaryPatternSyntax(UnaryPatternSyntax originalNode, UnaryPatternSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.OperatorToken, formattedNode.OperatorToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3648,9 +3648,9 @@ private CompareResult CompareUnaryPatternSyntax(UnaryPatternSyntax originalNode, formattedStack.Push((formattedNode.Pattern, formattedNode)); return Equal; } - private CompareResult CompareUndefDirectiveTriviaSyntax(UndefDirectiveTriviaSyntax originalNode, UndefDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareUndefDirectiveTriviaSyntax(UndefDirectiveTriviaSyntax originalNode, UndefDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -3665,9 +3665,9 @@ private CompareResult CompareUndefDirectiveTriviaSyntax(UndefDirectiveTriviaSynt if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareUnsafeStatementSyntax(UnsafeStatementSyntax originalNode, UnsafeStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareUnsafeStatementSyntax(UnsafeStatementSyntax originalNode, UnsafeStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Block, originalNode)); @@ -3677,9 +3677,9 @@ private CompareResult CompareUnsafeStatementSyntax(UnsafeStatementSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareUsingDirectiveSyntax(UsingDirectiveSyntax originalNode, UsingDirectiveSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareUsingDirectiveSyntax(UsingDirectiveSyntax originalNode, UsingDirectiveSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Alias, originalNode)); formattedStack.Push((formattedNode.Alias, formattedNode)); result = this.Compare(originalNode.GlobalKeyword, formattedNode.GlobalKeyword, originalNode, formattedNode); @@ -3699,9 +3699,9 @@ private CompareResult CompareUsingDirectiveSyntax(UsingDirectiveSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareUsingStatementSyntax(UsingStatementSyntax originalNode, UsingStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareUsingStatementSyntax(UsingStatementSyntax originalNode, UsingStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.AwaitKeyword, formattedNode.AwaitKeyword, originalNode, formattedNode); @@ -3721,21 +3721,21 @@ private CompareResult CompareUsingStatementSyntax(UsingStatementSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareVariableDeclarationSyntax(VariableDeclarationSyntax originalNode, VariableDeclarationSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareVariableDeclarationSyntax(VariableDeclarationSyntax originalNode, VariableDeclarationSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); originalStack.Push((originalNode.Type, originalNode)); formattedStack.Push((formattedNode.Type, formattedNode)); result = this.CompareLists(originalNode.Variables, formattedNode.Variables, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; - result = this.CompareLists(originalNode.Variables.GetSeparators().ToList(), formattedNode.Variables.GetSeparators().ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); + result = this.CompareLists(originalNode.Variables.GetSeparators().Take(originalNode.Variables.Count() - 1).ToList(), formattedNode.Variables.GetSeparators().Take(formattedNode.Variables.Count() - 1).ToList(), Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareVariableDeclaratorSyntax(VariableDeclaratorSyntax originalNode, VariableDeclaratorSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareVariableDeclaratorSyntax(VariableDeclaratorSyntax originalNode, VariableDeclaratorSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.ArgumentList, originalNode)); formattedStack.Push((formattedNode.ArgumentList, formattedNode)); result = this.Compare(originalNode.Identifier, formattedNode.Identifier, originalNode, formattedNode); @@ -3745,9 +3745,9 @@ private CompareResult CompareVariableDeclaratorSyntax(VariableDeclaratorSyntax o if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); return Equal; } - private CompareResult CompareVarPatternSyntax(VarPatternSyntax originalNode, VarPatternSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareVarPatternSyntax(VarPatternSyntax originalNode, VarPatternSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Designation, originalNode)); formattedStack.Push((formattedNode.Designation, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3755,9 +3755,9 @@ private CompareResult CompareVarPatternSyntax(VarPatternSyntax originalNode, Var if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareWarningDirectiveTriviaSyntax(WarningDirectiveTriviaSyntax originalNode, WarningDirectiveTriviaSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareWarningDirectiveTriviaSyntax(WarningDirectiveTriviaSyntax originalNode, WarningDirectiveTriviaSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.DirectiveNameToken, formattedNode.DirectiveNameToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EndOfDirectiveToken, formattedNode.EndOfDirectiveToken, originalNode, formattedNode); @@ -3770,9 +3770,9 @@ private CompareResult CompareWarningDirectiveTriviaSyntax(WarningDirectiveTrivia if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareWhenClauseSyntax(WhenClauseSyntax originalNode, WhenClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareWhenClauseSyntax(WhenClauseSyntax originalNode, WhenClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Condition, originalNode)); formattedStack.Push((formattedNode.Condition, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3780,9 +3780,9 @@ private CompareResult CompareWhenClauseSyntax(WhenClauseSyntax originalNode, Whe if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareWhereClauseSyntax(WhereClauseSyntax originalNode, WhereClauseSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareWhereClauseSyntax(WhereClauseSyntax originalNode, WhereClauseSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Condition, originalNode)); formattedStack.Push((formattedNode.Condition, formattedNode)); if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3790,9 +3790,9 @@ private CompareResult CompareWhereClauseSyntax(WhereClauseSyntax originalNode, W if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareWhileStatementSyntax(WhileStatementSyntax originalNode, WhileStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareWhileStatementSyntax(WhileStatementSyntax originalNode, WhileStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.CloseParenToken, formattedNode.CloseParenToken, originalNode, formattedNode); @@ -3808,9 +3808,9 @@ private CompareResult CompareWhileStatementSyntax(WhileStatementSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareWithExpressionSyntax(WithExpressionSyntax originalNode, WithExpressionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareWithExpressionSyntax(WithExpressionSyntax originalNode, WithExpressionSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Expression, originalNode)); formattedStack.Push((formattedNode.Expression, formattedNode)); originalStack.Push((originalNode.Initializer, originalNode)); @@ -3820,9 +3820,9 @@ private CompareResult CompareWithExpressionSyntax(WithExpressionSyntax originalN if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlCDataSectionSyntax(XmlCDataSectionSyntax originalNode, XmlCDataSectionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlCDataSectionSyntax(XmlCDataSectionSyntax originalNode, XmlCDataSectionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EndCDataToken, formattedNode.EndCDataToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3832,9 +3832,9 @@ private CompareResult CompareXmlCDataSectionSyntax(XmlCDataSectionSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlCommentSyntax(XmlCommentSyntax originalNode, XmlCommentSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlCommentSyntax(XmlCommentSyntax originalNode, XmlCommentSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.LessThanExclamationMinusMinusToken, formattedNode.LessThanExclamationMinusMinusToken, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3844,9 +3844,9 @@ private CompareResult CompareXmlCommentSyntax(XmlCommentSyntax originalNode, Xml if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlCrefAttributeSyntax(XmlCrefAttributeSyntax originalNode, XmlCrefAttributeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlCrefAttributeSyntax(XmlCrefAttributeSyntax originalNode, XmlCrefAttributeSyntax formattedNode) + { + CompareResult result; originalStack.Push((originalNode.Cref, originalNode)); formattedStack.Push((formattedNode.Cref, formattedNode)); result = this.Compare(originalNode.EndQuoteToken, formattedNode.EndQuoteToken, originalNode, formattedNode); @@ -3860,9 +3860,9 @@ private CompareResult CompareXmlCrefAttributeSyntax(XmlCrefAttributeSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlElementEndTagSyntax(XmlElementEndTagSyntax originalNode, XmlElementEndTagSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlElementEndTagSyntax(XmlElementEndTagSyntax originalNode, XmlElementEndTagSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.GreaterThanToken, formattedNode.GreaterThanToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3872,9 +3872,9 @@ private CompareResult CompareXmlElementEndTagSyntax(XmlElementEndTagSyntax origi formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareXmlElementStartTagSyntax(XmlElementStartTagSyntax originalNode, XmlElementStartTagSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlElementStartTagSyntax(XmlElementStartTagSyntax originalNode, XmlElementStartTagSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Attributes, formattedNode.Attributes, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; result = this.Compare(originalNode.GreaterThanToken, formattedNode.GreaterThanToken, originalNode, formattedNode); @@ -3886,9 +3886,9 @@ private CompareResult CompareXmlElementStartTagSyntax(XmlElementStartTagSyntax o formattedStack.Push((formattedNode.Name, formattedNode)); return Equal; } - private CompareResult CompareXmlElementSyntax(XmlElementSyntax originalNode, XmlElementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlElementSyntax(XmlElementSyntax originalNode, XmlElementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Content, formattedNode.Content, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.EndTag, originalNode)); @@ -3898,9 +3898,9 @@ private CompareResult CompareXmlElementSyntax(XmlElementSyntax originalNode, Xml formattedStack.Push((formattedNode.StartTag, formattedNode)); return Equal; } - private CompareResult CompareXmlEmptyElementSyntax(XmlEmptyElementSyntax originalNode, XmlEmptyElementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlEmptyElementSyntax(XmlEmptyElementSyntax originalNode, XmlEmptyElementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.Attributes, formattedNode.Attributes, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3912,9 +3912,9 @@ private CompareResult CompareXmlEmptyElementSyntax(XmlEmptyElementSyntax origina if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlNameAttributeSyntax(XmlNameAttributeSyntax originalNode, XmlNameAttributeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlNameAttributeSyntax(XmlNameAttributeSyntax originalNode, XmlNameAttributeSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EndQuoteToken, formattedNode.EndQuoteToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EqualsToken, formattedNode.EqualsToken, originalNode, formattedNode); @@ -3928,9 +3928,9 @@ private CompareResult CompareXmlNameAttributeSyntax(XmlNameAttributeSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlNameSyntax(XmlNameSyntax originalNode, XmlNameSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlNameSyntax(XmlNameSyntax originalNode, XmlNameSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.Compare(originalNode.LocalName, formattedNode.LocalName, originalNode, formattedNode); if (result.IsInvalid) return result; @@ -3938,9 +3938,9 @@ private CompareResult CompareXmlNameSyntax(XmlNameSyntax originalNode, XmlNameSy formattedStack.Push((formattedNode.Prefix, formattedNode)); return Equal; } - private CompareResult CompareXmlPrefixSyntax(XmlPrefixSyntax originalNode, XmlPrefixSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlPrefixSyntax(XmlPrefixSyntax originalNode, XmlPrefixSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.ColonToken, formattedNode.ColonToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3948,9 +3948,9 @@ private CompareResult CompareXmlPrefixSyntax(XmlPrefixSyntax originalNode, XmlPr if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlProcessingInstructionSyntax(XmlProcessingInstructionSyntax originalNode, XmlProcessingInstructionSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlProcessingInstructionSyntax(XmlProcessingInstructionSyntax originalNode, XmlProcessingInstructionSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EndProcessingInstructionToken, formattedNode.EndProcessingInstructionToken, originalNode, formattedNode); if (result.IsInvalid) return result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); @@ -3962,9 +3962,9 @@ private CompareResult CompareXmlProcessingInstructionSyntax(XmlProcessingInstruc if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlTextAttributeSyntax(XmlTextAttributeSyntax originalNode, XmlTextAttributeSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlTextAttributeSyntax(XmlTextAttributeSyntax originalNode, XmlTextAttributeSyntax formattedNode) + { + CompareResult result; result = this.Compare(originalNode.EndQuoteToken, formattedNode.EndQuoteToken, originalNode, formattedNode); if (result.IsInvalid) return result; result = this.Compare(originalNode.EqualsToken, formattedNode.EqualsToken, originalNode, formattedNode); @@ -3978,17 +3978,17 @@ private CompareResult CompareXmlTextAttributeSyntax(XmlTextAttributeSyntax origi if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareXmlTextSyntax(XmlTextSyntax originalNode, XmlTextSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareXmlTextSyntax(XmlTextSyntax originalNode, XmlTextSyntax formattedNode) + { + CompareResult result; if (originalNode.IsMissing != formattedNode.IsMissing) return NotEqual(originalNode, formattedNode); result = this.CompareLists(originalNode.TextTokens, formattedNode.TextTokens, Compare, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; return Equal; } - private CompareResult CompareYieldStatementSyntax(YieldStatementSyntax originalNode, YieldStatementSyntax formattedNode) - { - CompareResult result; + private CompareResult CompareYieldStatementSyntax(YieldStatementSyntax originalNode, YieldStatementSyntax formattedNode) + { + CompareResult result; result = this.CompareLists(originalNode.AttributeLists, formattedNode.AttributeLists, null, o => o.Span, originalNode.Span, formattedNode.Span); if (result.IsInvalid) return result; originalStack.Push((originalNode.Expression, originalNode)); diff --git a/Src/CSharpier/SyntaxPrinter/MembersWithForcedLines.cs b/Src/CSharpier/SyntaxPrinter/MembersWithForcedLines.cs index de771f466..3af051069 100644 --- a/Src/CSharpier/SyntaxPrinter/MembersWithForcedLines.cs +++ b/Src/CSharpier/SyntaxPrinter/MembersWithForcedLines.cs @@ -53,9 +53,21 @@ public static List Print( void AddSeparatorIfNeeded() { - if (members is SeparatedSyntaxList list && memberIndex < list.SeparatorCount) + if (members is SeparatedSyntaxList list) { - result.Add(Token.Print(list.GetSeparator(memberIndex), context)); + if (memberIndex < list.SeparatorCount) + { + result.Add(Token.Print(list.GetSeparator(memberIndex), context)); + } + else if ( + node is EnumDeclarationSyntax enumDeclarationSyntax + && member is EnumMemberDeclarationSyntax + ) + { + result.Add( + TrailingComma.Print(enumDeclarationSyntax.CloseBraceToken, context) + ); + } } } diff --git a/Src/CSharpier/SyntaxPrinter/SeparatedSyntaxList.cs b/Src/CSharpier/SyntaxPrinter/SeparatedSyntaxList.cs index c4ebf14ad..18a790774 100644 --- a/Src/CSharpier/SyntaxPrinter/SeparatedSyntaxList.cs +++ b/Src/CSharpier/SyntaxPrinter/SeparatedSyntaxList.cs @@ -7,7 +7,8 @@ public static Doc Print( Func printFunc, Doc afterSeparator, FormattingContext context, - int startingIndex = 0 + int startingIndex = 0, + Doc? trailingSeparator = null ) where T : SyntaxNode { @@ -16,16 +17,25 @@ public static Doc Print( { docs.Add(printFunc(list[x], context)); + var isTrailingSeparator = x == list.Count - 1; + if (x >= list.SeparatorCount) { + if (isTrailingSeparator && trailingSeparator != null) + { + docs.Add(trailingSeparator); + } + continue; } - var isTrailingSeparator = x == list.Count - 1; - - docs.Add(Token.Print(list.GetSeparator(x), context)); - if (!isTrailingSeparator) + if (isTrailingSeparator) + { + docs.Add(Doc.IfBreak(Token.Print(list.GetSeparator(x), context), Doc.Null)); + } + else { + docs.Add(Token.Print(list.GetSeparator(x), context)); docs.Add(afterSeparator); } } diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/AnonymousObjectCreationExpression.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/AnonymousObjectCreationExpression.cs index 14b23d399..e799b4440 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/AnonymousObjectCreationExpression.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/AnonymousObjectCreationExpression.cs @@ -16,7 +16,8 @@ public static Doc Print(AnonymousObjectCreationExpressionSyntax node, Formatting node.Initializers, AnonymousObjectMemberDeclarator.Print, Doc.Line, - context + context, + trailingSeparator: TrailingComma.Print(node.CloseBraceToken, context) ) ) : Doc.Null, diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CollectionExpression.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CollectionExpression.cs index dba7ca839..582c57d98 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CollectionExpression.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/CollectionExpression.cs @@ -35,7 +35,8 @@ or ExpressionStatementSyntax node.Elements, Node.Print, alwaysBreak ? Doc.HardLine : Doc.Line, - context + context, + trailingSeparator: TrailingComma.Print(node.CloseBracketToken, context) ) ) : Doc.Null, diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/InitializerExpression.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/InitializerExpression.cs index 25c78ecbf..f649d6cbc 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/InitializerExpression.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/InitializerExpression.cs @@ -38,14 +38,17 @@ is SyntaxKind.ArrayInitializerExpression node.Expressions, Node.Print, alwaysBreak ? Doc.HardLine : Doc.Line, - context + context, + trailingSeparator: node.Kind() + is not SyntaxKind.ComplexElementInitializerExpression + ? TrailingComma.Print(node.CloseBraceToken, context) + : Doc.Null ) ), alwaysBreak ? Doc.HardLine : Doc.Line ), Token.Print(node.CloseBraceToken, context) ); - return node.Parent is not ( diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ListPattern.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ListPattern.cs index 1254518f3..91a8dc0aa 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ListPattern.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ListPattern.cs @@ -8,7 +8,13 @@ public static Doc Print(ListPatternSyntax node, FormattingContext context) Token.Print(node.OpenBracketToken, context), Doc.Indent( Doc.SoftLine, - SeparatedSyntaxList.Print(node.Patterns, Node.Print, Doc.Line, context) + SeparatedSyntaxList.Print( + node.Patterns, + Node.Print, + Doc.Line, + context, + trailingSeparator: TrailingComma.Print(node.CloseBracketToken, context) + ) ), Doc.SoftLine, Token.Print(node.CloseBracketToken, context), diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchExpression.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchExpression.cs index 458a2a956..7fdd111a2 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchExpression.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchExpression.cs @@ -33,7 +33,8 @@ public static Doc Print(SwitchExpressionSyntax node, FormattingContext context) ) ), Doc.HardLine, - context + context, + trailingSeparator: TrailingComma.Print(node.CloseBraceToken, context) ) ), Doc.HardLine diff --git a/Src/CSharpier/SyntaxPrinter/TrailingComma.cs b/Src/CSharpier/SyntaxPrinter/TrailingComma.cs new file mode 100644 index 000000000..1502734c1 --- /dev/null +++ b/Src/CSharpier/SyntaxPrinter/TrailingComma.cs @@ -0,0 +1,14 @@ +namespace CSharpier.SyntaxPrinter; + +internal static class TrailingComma +{ + public static Doc Print(SyntaxToken nextSyntaxToken, FormattingContext context) + { + return !nextSyntaxToken.LeadingTrivia.Any(o => o.IsDirective) + ? Doc.IfBreak( + Token.Print(SyntaxFactory.Token(SyntaxKind.CommaToken), context), + Doc.Null + ) + : Doc.Null; + } +}