2492 references to Generator
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2492)
CodeGeneration\SyntaxGeneratorTests.cs (2492)
68VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0), "0"); 69VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1), "1"); 70VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1), "-1"); 71VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MinValue), "global::System.Int32.MinValue"); 72VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MaxValue), "global::System.Int32.MaxValue"); 74VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0L), "0L"); 75VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1L), "1L"); 76VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1L), "-1L"); 77VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MinValue), "global::System.Int64.MinValue"); 78VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MaxValue), "global::System.Int64.MaxValue"); 80VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0UL), "0UL"); 81VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1UL), "1UL"); 82VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ulong.MinValue), "0UL"); 83VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ulong.MaxValue), "global::System.UInt64.MaxValue"); 85VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0f), "0F"); 86VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0f), "1F"); 87VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0f), "-1F"); 88VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MinValue), "global::System.Single.MinValue"); 89VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MaxValue), "global::System.Single.MaxValue"); 90VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.Epsilon), "global::System.Single.Epsilon"); 91VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NaN), "global::System.Single.NaN"); 92VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NegativeInfinity), "global::System.Single.NegativeInfinity"); 93VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.PositiveInfinity), "global::System.Single.PositiveInfinity"); 95VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0), "0D"); 96VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0), "1D"); 97VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0), "-1D"); 98VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MinValue), "global::System.Double.MinValue"); 99VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MaxValue), "global::System.Double.MaxValue"); 100VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.Epsilon), "global::System.Double.Epsilon"); 101VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NaN), "global::System.Double.NaN"); 102VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NegativeInfinity), "global::System.Double.NegativeInfinity"); 103VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.PositiveInfinity), "global::System.Double.PositiveInfinity"); 105VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0m), "0M"); 106VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.00m), "0.00M"); 107VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.00m), "1.00M"); 108VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.00m), "-1.00M"); 109VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0000000000m), "1.0000000000M"); 110VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.000000m), "0.000000M"); 111VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0000000m), "0.0000000M"); 112VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1000000000m), "1000000000M"); 113VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(123456789.123456789m), "123456789.123456789M"); 114VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-28m), "0.0000000000000000000000000001M"); 115VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0E-28m), "0.0000000000000000000000000000M"); 116VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-29m), "0.0000000000000000000000000000M"); 117VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(-1E-29m), "0.0000000000000000000000000000M"); 118VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MinValue), "global::System.Decimal.MinValue"); 119VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MaxValue), "global::System.Decimal.MaxValue"); 121VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression('c'), "'c'"); 123VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("str"), """ 126VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("s\"t\"r"), """ 130VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(true), "true"); 131VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(false), "false"); 137VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)0), "0"); 138VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)1), "1"); 139VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((short)-1), "-1"); 140VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MinValue), "global::System.Int16.MinValue"); 141VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MaxValue), "global::System.Int16.MaxValue"); 147VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)0), "0"); 148VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)1), "1"); 149VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ushort.MinValue), "0"); 150VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ushort.MaxValue), "global::System.UInt16.MaxValue"); 156VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)0), "0"); 157VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)1), "1"); 158VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((sbyte)-1), "-1"); 159VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MinValue), "global::System.SByte.MinValue"); 160VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MaxValue), "global::System.SByte.MaxValue"); 166VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)0), "0"); 167VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)1), "1"); 168VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MinValue), "0"); 169VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MaxValue), "255"); 175VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 183VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 191VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 199VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 207VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 215VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 224VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 232VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 240VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 248var attributes = Generator.GetAttributes(Generator.AddAttributes( 249Generator.NamespaceDeclaration("n"), 250Generator.Attribute("Attr"))); 264VerifySyntax<IdentifierNameSyntax>(Generator.IdentifierName("x"), "x"); 265VerifySyntax<QualifiedNameSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 266VerifySyntax<QualifiedNameSyntax>(Generator.DottedName("x.y"), "x.y"); 268VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 269VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 272VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x<y>"); 275VerifySyntax<QualifiedNameSyntax>(Generator.WithTypeArguments(Generator.DottedName("x.y"), Generator.IdentifierName("z")), "x.y<z>"); 278VerifySyntax<MemberAccessExpressionSyntax>(Generator.WithTypeArguments(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y<z>"); 281var gname = Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")); 283VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(gname, Generator.IdentifierName("z")), "x<z>"); 290VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 291VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 292VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 293VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 294VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 296VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 297VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 298VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 299VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 302VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x")), "x"); 303VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x"), "y"), "x y"); 304VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType), "global::System.Int32"); 305VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType, "y"), "global::System.Int32 y"); 306VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 307VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 308VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, ["x", "y"]), "(global::System.Int32 x, global::System.Int32 y)"); 314VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 315VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 317VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 318VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 320VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 321VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 323VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 324VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 326VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 327VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 329VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 330VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 332VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 333VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 340VerifySyntax<QualifiedNameSyntax>(Generator.TypeExpression(genericType), "global::System.Collections.Generic.IEnumerable<T>"); 343VerifySyntax<ArrayTypeSyntax>(Generator.TypeExpression(arrayType), "global::System.Int32[]"); 349VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.NegateExpression(Generator.IdentifierName("x")), "-x"); 350VerifySyntax<BinaryExpressionSyntax>(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x + y"); 351VerifySyntax<BinaryExpressionSyntax>(Generator.SubtractExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x - y"); 352VerifySyntax<BinaryExpressionSyntax>(Generator.MultiplyExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x * y"); 353VerifySyntax<BinaryExpressionSyntax>(Generator.DivideExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x / y"); 354VerifySyntax<BinaryExpressionSyntax>(Generator.ModuloExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x % y"); 356VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.BitwiseNotExpression(Generator.IdentifierName("x")), "~x"); 357VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x & y"); 358VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x | y"); 360VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LogicalNotExpression(Generator.IdentifierName("x")), "!x"); 361VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x && y"); 362VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x || y"); 368VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x == y"); 369VerifySyntax<BinaryExpressionSyntax>(Generator.ValueEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x == y"); 371VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x != y"); 372VerifySyntax<BinaryExpressionSyntax>(Generator.ValueNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x != y"); 374VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x < y"); 375VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x <= y"); 377VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x > y"); 378VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x >= y"); 384VerifySyntax<BinaryExpressionSyntax>(Generator.CoalesceExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x ?? y"); 385VerifySyntax<ConditionalExpressionSyntax>(Generator.ConditionalExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x ? y : z"); 391VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 392VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), "y"), "x.y"); 393VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y.z"); 394VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x(y).z"); 395VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x[y].z"); 396VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "(x + y).z"); 397VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.NegateExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y")), "(-x).y"); 404Generator.ArrayCreationExpression(Generator.IdentifierName("x"), Generator.LiteralExpression(10)), 408Generator.ArrayCreationExpression(Generator.IdentifierName("x"), new SyntaxNode[] { Generator.IdentifierName("y"), Generator.IdentifierName("z") }), 422Generator.ObjectCreationExpression(Generator.IdentifierName("x")), 426Generator.ObjectCreationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 434Generator.ObjectCreationExpression(listOfIntType, Generator.IdentifierName("y")), 442Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 446Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), 450Generator.ElementAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 454Generator.ElementAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 458Generator.ElementAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 462Generator.ElementAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 469VerifySyntax<CastExpressionSyntax>(Generator.CastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)y"); 470VerifySyntax<CastExpressionSyntax>(Generator.ConvertExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)y"); 476VerifySyntax<BinaryExpressionSyntax>(Generator.IsTypeExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x is y"); 477VerifySyntax<BinaryExpressionSyntax>(Generator.TryCastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x as y"); 478VerifySyntax<TypeOfExpressionSyntax>(Generator.TypeOfExpression(Generator.IdentifierName("x")), "typeof(x)"); 485VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x")), "x()"); 486VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x(y)"); 487VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x(y, z)"); 490VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(Generator.IdentifierName("y"))), "x(y)"); 491VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 492VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 495VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x.y()"); 496VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x[y]()"); 497VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x(y)()"); 498VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "(x + y)()"); 503=> VerifySyntax<AssignmentExpressionSyntax>(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x = y"); 508VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.IdentifierName("x")), "x;"); 509VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("x"))), "x();"); 515VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y"), "x y;"); 516VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;"); 518VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", isConst: true), "const x y;"); 519VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;"); 521VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement("y", Generator.IdentifierName("z")), "var y = z;"); 527Generator.AddEventHandler(Generator.IdentifierName("@event"), Generator.IdentifierName("handler")), 533Generator.RemoveEventHandler(Generator.IdentifierName("@event"), 534Generator.IdentifierName("handler")), "@event -= handler"); 538=> VerifySyntax<AwaitExpressionSyntax>(Generator.AwaitExpression(Generator.IdentifierName("x")), "await x"); 542=> VerifySyntax<InvocationExpressionSyntax>(Generator.NameOfExpression(Generator.IdentifierName("x")), "nameof(x)"); 547VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression( 548[Generator.IdentifierName("x"), Generator.IdentifierName("y")]), "(x, y)"); 550VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression([ 551Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 552Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y"))]), "(goo: x, bar: y)"); 558VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(), "return;"); 559VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(Generator.IdentifierName("x")), "return x;"); 565VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.LiteralExpression(1)), "yield return 1;"); 566VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.IdentifierName("x")), "yield return x;"); 572VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(), "throw;"); 573VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(Generator.IdentifierName("x")), "throw x;"); 580Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }), 584Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }, new SyntaxNode[] { }), 588Generator.IfStatement(Generator.IdentifierName("x"), 589new SyntaxNode[] { Generator.IdentifierName("y") }), 593Generator.IfStatement(Generator.IdentifierName("x"), 594new SyntaxNode[] { Generator.IdentifierName("y") }, 595new SyntaxNode[] { Generator.IdentifierName("z") }), 599Generator.IfStatement(Generator.IdentifierName("x"), 600new SyntaxNode[] { Generator.IdentifierName("y") }, 601Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") })), 605Generator.IfStatement(Generator.IdentifierName("x"), 606new SyntaxNode[] { Generator.IdentifierName("y") }, 607Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") }, Generator.IdentifierName("z"))), 615Generator.SwitchStatement(Generator.IdentifierName("x"), 616Generator.SwitchSection(Generator.IdentifierName("y"), 617[Generator.IdentifierName("z")])), 621Generator.SwitchStatement(Generator.IdentifierName("x"), 622Generator.SwitchSection( 623[Generator.IdentifierName("y"), Generator.IdentifierName("p"), Generator.IdentifierName("q")], 624[Generator.IdentifierName("z")])), 628Generator.SwitchStatement(Generator.IdentifierName("x"), 629Generator.SwitchSection(Generator.IdentifierName("y"), 630[Generator.IdentifierName("z")]), 631Generator.SwitchSection(Generator.IdentifierName("a"), 632[Generator.IdentifierName("b")])), 636Generator.SwitchStatement(Generator.IdentifierName("x"), 637Generator.SwitchSection(Generator.IdentifierName("y"), 638[Generator.IdentifierName("z")]), 639Generator.DefaultSwitchSection( 640[Generator.IdentifierName("b")])), 644Generator.SwitchStatement(Generator.IdentifierName("x"), 645Generator.SwitchSection(Generator.IdentifierName("y"), 646[Generator.ExitSwitchStatement()])), 650Generator.SwitchStatement(Generator.TupleExpression([Generator.IdentifierName("x1"), Generator.IdentifierName("x2")]), 651Generator.SwitchSection(Generator.IdentifierName("y"), 652[Generator.IdentifierName("z")])), 661Generator.UsingStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 665Generator.UsingStatement("x", Generator.IdentifierName("y"), [Generator.IdentifierName("z")]), 669Generator.UsingStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), [Generator.IdentifierName("q")]), 676Generator.LockStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 683Generator.TryCatchStatement( 684[Generator.IdentifierName("x")], 685Generator.CatchClause(Generator.IdentifierName("y"), "z", 686[Generator.IdentifierName("a")])), 690Generator.TryCatchStatement( 691[Generator.IdentifierName("s")], 692Generator.CatchClause(Generator.IdentifierName("x"), "y", 693[Generator.IdentifierName("z")]), 694Generator.CatchClause(Generator.IdentifierName("a"), "b", 695[Generator.IdentifierName("c")])), 699Generator.TryCatchStatement( 700[Generator.IdentifierName("s")], 701[Generator.CatchClause(Generator.IdentifierName("x"), "y", [Generator.IdentifierName("z")])], 702[Generator.IdentifierName("a")]), 706Generator.TryFinallyStatement( 707[Generator.IdentifierName("x")], 708[Generator.IdentifierName("a")]), 716Generator.WhileStatement(Generator.IdentifierName("x"), 717[Generator.IdentifierName("y")]), 721Generator.WhileStatement(Generator.IdentifierName("x"), null), 729Generator.ValueReturningLambdaExpression("x", Generator.IdentifierName("y")), 733Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 737Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 741Generator.VoidReturningLambdaExpression("x", Generator.IdentifierName("y")), 745Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 749Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 753Generator.ValueReturningLambdaExpression("x", [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 757Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.ReturnStatement(Generator.IdentifierName("z"))]), 761Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 765Generator.VoidReturningLambdaExpression("x", [Generator.IdentifierName("y")]), 769Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.IdentifierName("z")]), 773Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, [Generator.IdentifierName("y")]), 777Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 781Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 785Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 789Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 799Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32)), 803Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer: Generator.LiteralExpression(0)), 807Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public), 811Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Static | DeclarationModifiers.ReadOnly), 815Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Required), 823Generator.MethodDeclaration("m"), 827Generator.MethodDeclaration("m", typeParameters: ["x", "y"]), 831Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), 835Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), statements: [Generator.IdentifierName("y")]), 839Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], returnType: Generator.IdentifierName("x")), 843Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"), Generator.IdentifierName("a"))], returnType: Generator.IdentifierName("x")), 847Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public), 851Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 855Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial), 859Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial, statements: [Generator.IdentifierName("y")]), 863Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial | DeclarationModifiers.Async, statements: null), 875var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 876var returnType = Generator.TypeExpression(SpecialType.System_Boolean); 879Generator.OperatorDeclaration(OperatorKind.Addition, parameters, returnType), 883Generator.OperatorDeclaration(OperatorKind.BitwiseAnd, parameters, returnType), 887Generator.OperatorDeclaration(OperatorKind.BitwiseOr, parameters, returnType), 891Generator.OperatorDeclaration(OperatorKind.Decrement, parameters, returnType), 895Generator.OperatorDeclaration(OperatorKind.Division, parameters, returnType), 899Generator.OperatorDeclaration(OperatorKind.Equality, parameters, returnType), 903Generator.OperatorDeclaration(OperatorKind.ExclusiveOr, parameters, returnType), 907Generator.OperatorDeclaration(OperatorKind.False, parameters, returnType), 911Generator.OperatorDeclaration(OperatorKind.GreaterThan, parameters, returnType), 915Generator.OperatorDeclaration(OperatorKind.GreaterThanOrEqual, parameters, returnType), 919Generator.OperatorDeclaration(OperatorKind.Increment, parameters, returnType), 923Generator.OperatorDeclaration(OperatorKind.Inequality, parameters, returnType), 927Generator.OperatorDeclaration(OperatorKind.LeftShift, parameters, returnType), 931Generator.OperatorDeclaration(OperatorKind.LessThan, parameters, returnType), 935Generator.OperatorDeclaration(OperatorKind.LessThanOrEqual, parameters, returnType), 939Generator.OperatorDeclaration(OperatorKind.LogicalNot, parameters, returnType), 943Generator.OperatorDeclaration(OperatorKind.Modulus, parameters, returnType), 947Generator.OperatorDeclaration(OperatorKind.Multiply, parameters, returnType), 951Generator.OperatorDeclaration(OperatorKind.OnesComplement, parameters, returnType), 955Generator.OperatorDeclaration(OperatorKind.RightShift, parameters, returnType), 959Generator.OperatorDeclaration(OperatorKind.UnsignedRightShift, parameters, returnType), 963Generator.OperatorDeclaration(OperatorKind.Subtraction, parameters, returnType), 967Generator.OperatorDeclaration(OperatorKind.True, parameters, returnType), 971Generator.OperatorDeclaration(OperatorKind.UnaryNegation, parameters, returnType), 975Generator.OperatorDeclaration(OperatorKind.UnaryPlus, parameters, returnType), 981Generator.OperatorDeclaration(OperatorKind.ImplicitConversion, parameters, returnType), 985Generator.OperatorDeclaration(OperatorKind.ExplicitConversion, parameters, returnType), 992var returnType = Generator.TypeExpression(SpecialType.System_Void); 995Generator.OperatorDeclaration(OperatorKind.Increment, [], returnType), 999Generator.OperatorDeclaration(OperatorKind.Decrement, [], returnType), 1006var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 1009Generator.OperatorDeclaration(OperatorKind.AdditionAssignment, parameters, returnType), 1013Generator.OperatorDeclaration(OperatorKind.SubtractionAssignment, parameters, returnType), 1017Generator.OperatorDeclaration(OperatorKind.MultiplicationAssignment, parameters, returnType), 1021Generator.OperatorDeclaration(OperatorKind.DivisionAssignment, parameters, returnType), 1025Generator.OperatorDeclaration(OperatorKind.ModulusAssignment, parameters, returnType), 1029Generator.OperatorDeclaration(OperatorKind.ExclusiveOrAssignment, parameters, returnType), 1033Generator.OperatorDeclaration(OperatorKind.BitwiseAndAssignment, parameters, returnType), 1037Generator.OperatorDeclaration(OperatorKind.BitwiseOrAssignment, parameters, returnType), 1041Generator.OperatorDeclaration(OperatorKind.LeftShiftAssignment, parameters, returnType), 1045Generator.OperatorDeclaration(OperatorKind.RightShiftAssignment, parameters, returnType), 1049Generator.OperatorDeclaration(OperatorKind.UnsignedRightShiftAssignment, parameters, returnType), 1064VerifySyntax<OperatorDeclarationSyntax>(Generator.OperatorDeclaration(operatorSymbol), "public static global::C operator checked ++(global::C x)\r\n{\r\n}"); 1075Generator.Declaration(conversion), 1082Generator.Declaration(conversion), 1100Generator.OperatorDeclaration(op), 1108Generator.ConstructorDeclaration(), 1112Generator.ConstructorDeclaration("c"), 1116Generator.ConstructorDeclaration("c", accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static), 1120Generator.ConstructorDeclaration("c", [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))]), 1124Generator.ConstructorDeclaration("c", 1125parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], 1126baseConstructorArguments: [Generator.IdentifierName("p")]), 1134Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1138Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1142Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1146Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: []), 1150Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1154Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: []), 1158Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1162Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Required), 1166Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: [Generator.IdentifierName("y")]), 1170Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: [Generator.IdentifierName("y")]), 1174Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), setAccessorStatements: [Generator.IdentifierName("y")]), 1178Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), getAccessorStatements: [], setAccessorStatements: [Generator.IdentifierName("y")]), 1186Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1190Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1194Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1198Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1202Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1206Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, 1207getAccessorStatements: [Generator.IdentifierName("a")]), 1211Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, 1212setAccessorStatements: [Generator.IdentifierName("a")]), 1216Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x")), 1220Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1221setAccessorStatements: [Generator.IdentifierName("a")]), 1225Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1226getAccessorStatements: [Generator.IdentifierName("a")], setAccessorStatements: [Generator.IdentifierName("b")]), 1234Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1238Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public), 1242Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static), 1250Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1254Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 1258Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), 1262Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), addAccessorStatements: [Generator.IdentifierName("s")], removeAccessorStatements: [Generator.IdentifierName("s2")]), 1270Generator.AsPublicInterfaceImplementation( 1271Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1272Generator.IdentifierName("i")), 1276Generator.AsPublicInterfaceImplementation( 1277Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1278Generator.IdentifierName("i")), 1282Generator.AsPublicInterfaceImplementation( 1283Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1284Generator.IdentifierName("i")), 1288var pim = Generator.AsPrivateInterfaceImplementation( 1289Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1290Generator.IdentifierName("i")); 1293Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1297Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1302Generator.AsPublicInterfaceImplementation( 1333Generator.IdentifierName("i")), 1337Generator.AsPublicInterfaceImplementation( 1372Generator.IdentifierName("i")), 1376Generator.AsPublicInterfaceImplementation( 1433Generator.IdentifierName("i")), 1437Generator.AsPublicInterfaceImplementation( 1453Generator.IdentifierName("i")), 1457Generator.AsPublicInterfaceImplementation( 1477Generator.IdentifierName("i")), 1481Generator.AsPublicInterfaceImplementation( 1503Generator.IdentifierName("i")), 1507Generator.AsPublicInterfaceImplementation( 1534Generator.IdentifierName("i")), 1538Generator.AsPublicInterfaceImplementation( 1564Generator.IdentifierName("i")), 1573Generator.AsPrivateInterfaceImplementation( 1574Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1575Generator.IdentifierName("i")), 1579Generator.AsPrivateInterfaceImplementation( 1580Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1581Generator.IdentifierName("i")), 1585Generator.AsPrivateInterfaceImplementation( 1586Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Protected, modifiers: DeclarationModifiers.Abstract), 1587Generator.IdentifierName("i")), 1591Generator.AsPrivateInterfaceImplementation( 1592Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1593Generator.IdentifierName("i")), 1597var pim = Generator.AsPublicInterfaceImplementation( 1598Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1599Generator.IdentifierName("i")); 1602Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1606Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1622var method = Generator.GetMembers(iface)[0]; 1624var privateMethod = Generator.AsPrivateInterfaceImplementation(method, Generator.IdentifierName("IFace")); 1635Generator.ClassDeclaration("c"), 1639Generator.ClassDeclaration("c", typeParameters: ["x", "y"]), 1643Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x")), 1647Generator.ClassDeclaration("c", interfaceTypes: [Generator.IdentifierName("x")]), 1651Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x"), interfaceTypes: [Generator.IdentifierName("y")]), 1655Generator.ClassDeclaration("c", interfaceTypes: new SyntaxNode[] { }), 1659Generator.ClassDeclaration("c", members: [Generator.FieldDeclaration("y", type: Generator.IdentifierName("x"))]), 1663Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1667Generator.ClassDeclaration("c", members: [Generator.ConstructorDeclaration()]), 1675Generator.StructDeclaration("s"), 1679Generator.StructDeclaration("s", typeParameters: ["x", "y"]), 1683Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x")]), 1687Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1691Generator.StructDeclaration("s", interfaceTypes: new SyntaxNode[] { }), 1695Generator.StructDeclaration("s", members: [Generator.FieldDeclaration("y", Generator.IdentifierName("x"))]), 1699Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1703Generator.StructDeclaration("s", members: [Generator.ConstructorDeclaration("xxx")]), 1711Generator.InterfaceDeclaration("i"), 1715Generator.InterfaceDeclaration("i", typeParameters: ["x", "y"]), 1719Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a")]), 1723Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a"), Generator.IdentifierName("b")]), 1727Generator.InterfaceDeclaration("i", interfaceTypes: new SyntaxNode[] { }), 1731Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1735Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1739Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.ReadOnly)]), 1743Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.Sealed)]), 1747Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.ReadOnly)]), 1751Generator.InterfaceDeclaration("i", members: [Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1755Generator.InterfaceDeclaration("i", members: [Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1759Generator.InterfaceDeclaration("i", members: [Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1773Generator.Declaration(symbol), 1781Generator.EnumDeclaration("e"), 1785Generator.EnumDeclaration("e", members: [Generator.EnumMember("a"), Generator.EnumMember("b"), Generator.EnumMember("c")]), 1789Generator.EnumDeclaration("e", members: [Generator.IdentifierName("a"), Generator.EnumMember("b"), Generator.IdentifierName("c")]), 1793Generator.EnumDeclaration("e", members: [Generator.EnumMember("a", Generator.LiteralExpression(0)), Generator.EnumMember("b"), Generator.EnumMember("c", Generator.LiteralExpression(5))]), 1797Generator.EnumDeclaration("e", members: [Generator.FieldDeclaration("a", Generator.IdentifierName("e"), initializer: Generator.LiteralExpression(1))]), 1805Generator.DelegateDeclaration("d"), 1809Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t")), 1813Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t"), parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))]), 1817Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1821Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1825Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New), 1829Generator.DelegateDeclaration("d", typeParameters: ["T", "S"]), 1837Generator.NamespaceImportDeclaration(Generator.IdentifierName("n")), 1841Generator.NamespaceImportDeclaration("n"), 1845Generator.NamespaceImportDeclaration("n.m"), 1853Generator.NamespaceDeclaration("n"), 1857Generator.NamespaceDeclaration("n.m"), 1861Generator.NamespaceDeclaration("n", 1862Generator.NamespaceImportDeclaration("m")), 1866Generator.NamespaceDeclaration("n", 1867Generator.ClassDeclaration("c"), 1868Generator.NamespaceImportDeclaration("m")), 1876Generator.CompilationUnit(), 1880Generator.CompilationUnit( 1881Generator.NamespaceDeclaration("n")), 1885Generator.CompilationUnit( 1886Generator.NamespaceImportDeclaration("n")), 1890Generator.CompilationUnit( 1891Generator.ClassDeclaration("c"), 1892Generator.NamespaceImportDeclaration("m")), 1896Generator.CompilationUnit( 1897Generator.NamespaceImportDeclaration("n"), 1898Generator.NamespaceDeclaration("n", 1899Generator.NamespaceImportDeclaration("m"), 1900Generator.ClassDeclaration("c"))), 1908Generator.Attribute(Generator.IdentifierName("a")), 1912Generator.Attribute("a"), 1916Generator.Attribute("a.b"), 1920Generator.Attribute("a", []), 1924Generator.Attribute("a", [Generator.IdentifierName("x")]), 1928Generator.Attribute("a", [Generator.AttributeArgument(Generator.IdentifierName("x"))]), 1932Generator.Attribute("a", [Generator.AttributeArgument("x", Generator.IdentifierName("y"))]), 1936Generator.Attribute("a", [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1944Generator.AddAttributes( 1945Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1946Generator.Attribute("a")), 1950Generator.AddAttributes( 1951Generator.AddAttributes( 1952Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1953Generator.Attribute("a")), 1954Generator.Attribute("b")), 1958Generator.AddAttributes( 1959Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1960Generator.Attribute("a")), 1964Generator.AddReturnAttributes( 1965Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1966Generator.Attribute("a")), 1970Generator.AddAttributes( 1971Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Abstract), 1972Generator.Attribute("a")), 1976Generator.AddAttributes( 1977Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1978Generator.Attribute("a")), 1982Generator.AddAttributes( 1983Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1984Generator.Attribute("a")), 1988Generator.AddAttributes( 1989Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1990Generator.Attribute("a")), 1994Generator.AddAttributes( 1995Generator.ClassDeclaration("c"), 1996Generator.Attribute("a")), 2000Generator.AddAttributes( 2001Generator.StructDeclaration("s"), 2002Generator.Attribute("a")), 2006Generator.AddAttributes( 2007Generator.InterfaceDeclaration("i"), 2008Generator.Attribute("a")), 2012Generator.AddAttributes( 2013Generator.DelegateDeclaration("d"), 2014Generator.Attribute("a")), 2018Generator.AddAttributes( 2019Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), 2020Generator.Attribute("a")), 2024Generator.AddAttributes( 2025Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2026Generator.Attribute("a")), 2030Generator.AddAttributes( 2031Generator.AddAttributes( 2032Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2033Generator.Attribute("a")), 2034Generator.Attribute("b")), 2038Generator.AddAttributes( 2040Generator.Attribute("a")), 2044Generator.AddAttributes( 2046Generator.Attribute("a")), 2050Generator.AddAttributes( 2052Generator.Attribute("a")), 2059var prop = Generator.PropertyDeclaration("P", Generator.IdentifierName("T")); 2060var evnt = Generator.CustomEventDeclaration("E", Generator.IdentifierName("T")); 2061CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.GetAccessor)); 2062CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.SetAccessor)); 2063CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.AddAccessor)); 2064CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.RemoveAccessor)); 2069var initialAttributes = Generator.GetAttributes(declaration); 2072var withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")); 2073var attrsAdded = Generator.GetAttributes(withAttribute); 2076var withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded[0]); 2077var attrsRemoved = Generator.GetAttributes(withoutAttribute); 2089var added = Generator.AddAttributes(cls, Generator.Attribute("a")); 2092var removed = Generator.RemoveAllAttributes(added); 2095var attrWithComment = Generator.GetAttributes(added).First(); 2103Generator.WithTypeParameters( 2104Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2109Generator.WithTypeParameters( 2110Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract)), 2114Generator.WithTypeParameters( 2115Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2120Generator.WithTypeParameters(Generator.WithTypeParameters( 2121Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2126Generator.WithTypeParameters( 2127Generator.ClassDeclaration("c"), 2132Generator.WithTypeParameters( 2133Generator.StructDeclaration("s"), 2138Generator.WithTypeParameters( 2139Generator.InterfaceDeclaration("i"), 2144Generator.WithTypeParameters( 2145Generator.DelegateDeclaration("d"), 2154Generator.WithTypeConstraint( 2155Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2156"a", Generator.IdentifierName("b")), 2160Generator.WithTypeConstraint( 2161Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2162"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2166Generator.WithTypeConstraint( 2167Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2172Generator.WithTypeConstraint(Generator.WithTypeConstraint( 2173Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2174"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), "a"), 2178Generator.WithTypeConstraint( 2179Generator.WithTypeConstraint( 2180Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a", "x"), 2181"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2182"x", Generator.IdentifierName("y")), 2186Generator.WithTypeConstraint( 2187Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2192Generator.WithTypeConstraint( 2193Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2198Generator.WithTypeConstraint( 2199Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2204Generator.WithTypeConstraint( 2205Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2210Generator.WithTypeConstraint( 2211Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2216Generator.WithTypeConstraint( 2217Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2218"a", SpecialTypeConstraintKind.ReferenceType, Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2223Generator.WithTypeConstraint( 2224Generator.WithTypeParameters( 2225Generator.ClassDeclaration("c"), 2227"a", Generator.IdentifierName("x")), 2231Generator.WithTypeConstraint( 2232Generator.WithTypeParameters( 2233Generator.StructDeclaration("s"), 2235"a", Generator.IdentifierName("x")), 2239Generator.WithTypeConstraint( 2240Generator.WithTypeParameters( 2241Generator.InterfaceDeclaration("i"), 2243"a", Generator.IdentifierName("x")), 2247Generator.WithTypeConstraint( 2248Generator.WithTypeParameters( 2249Generator.DelegateDeclaration("d"), 2251"a", Generator.IdentifierName("x")), 2258Generator.Declaration(_emptyCompilation.GetTypeByMetadataName("System.ComponentModel.INotifyPropertyChanged")), 2269Generator.Declaration( 2280Generator.Declaration( 2294Generator.Declaration( 2314VerifySyntax<DelegateDeclarationSyntax>(Generator.Declaration(type), """ 2333Generator.Declaration(method), """ 2354Generator.Declaration(method), """ 2375Generator.Declaration(method), """ 2396Generator.Declaration(method), """ 2417Generator.Declaration(method), 2439Generator.Declaration(property), 2457Generator.Declaration(property), 2480Generator.Declaration(property), 2508Generator.Declaration(property), 2536Generator.Declaration(property), 2567Generator.Declaration(property), 2604Generator.Declaration(method), 2611Generator.Declaration(property), 2614Generator.Declaration(indexer), 2624Generator.Declaration(ev), 2644Generator.Declaration(field), 2667Generator.Declaration(field), 2677Generator.Declaration(field), 2697Generator.Declaration(method), """ 2710var actualNames = actualNodes.Select(n => Generator.GetName(n)).ToArray(); 2720=> AssertNamesEqual(expectedNames, Generator.GetMembers(declaration)); 2723=> AssertNamesEqual([expectedName], Generator.GetMembers(declaration)); 2728AssertNamesEqual("x.y", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y")))); 2729AssertNamesEqual(["x.y", "z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y"), Generator.IdentifierName("z")))); 2730AssertNamesEqual("", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.MethodDeclaration("m")))); 2731AssertNamesEqual(["x", "y.z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(Generator.IdentifierName("x")), Generator.DottedName("y.z")))); 2737TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"))); 2738TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y"))); 2740TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x")), "x", []); 2741TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "x", ["y"]); 2742TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "y", ["x"]); 2746=> Assert.Equal(0, Generator.GetNamespaceImports(Generator.RemoveNodes(declaration, Generator.GetNamespaceImports(declaration))).Count); 2750var newDecl = Generator.RemoveNode(declaration, Generator.GetNamespaceImports(declaration).First(m => Generator.GetName(m) == name)); 2751AssertNamesEqual(remainingNames, Generator.GetNamespaceImports(newDecl)); 2768var newCu = Generator.RemoveNode(cu, summary); 2796var newCu = Generator.ReplaceNode(cu, summary, summary2); 2821var newCu = Generator.InsertNodesAfter(cu, text, [text]); 2846var newCu = Generator.InsertNodesBefore(cu, text, [text]); 2860AssertMemberNamesEqual("m", Generator.AddMembers(Generator.ClassDeclaration("d"), [Generator.MethodDeclaration("m")])); 2861AssertMemberNamesEqual("m", Generator.AddMembers(Generator.StructDeclaration("s"), [Generator.MethodDeclaration("m")])); 2862AssertMemberNamesEqual("m", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.MethodDeclaration("m")])); 2863AssertMemberNamesEqual("", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.OperatorDeclaration(OperatorKind.Addition)])); 2864AssertMemberNamesEqual("v", Generator.AddMembers(Generator.EnumDeclaration("e"), [Generator.EnumMember("v")])); 2865AssertMemberNamesEqual("n2", Generator.AddMembers(Generator.NamespaceDeclaration("n"), [Generator.NamespaceDeclaration("n2")])); 2866AssertMemberNamesEqual("n", Generator.AddMembers(Generator.CompilationUnit(), [Generator.NamespaceDeclaration("n")])); 2868AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.ClassDeclaration("d", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2869AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2870AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2871AssertMemberNamesEqual(["v", "v2"], Generator.AddMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")]), [Generator.EnumMember("v2")])); 2872AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2873AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2879VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2880[Generator.OperatorDeclaration(OperatorKind.Addition)]), 2888VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2889[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Abstract)]), 2897VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2898[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Virtual)]), 2911var node = Generator.AddMembers(Generator.ClassDeclaration("C"), 2913Generator.MethodDeclaration("M1", returnType: Generator.TypeExpression(SpecialType.System_Void), accessibility: Accessibility.Public), 2914Generator.PropertyDeclaration("P1", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public) 2934var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("m"); 2936method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2938VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2947var getAccessor = (AccessorDeclarationSyntax)Generator.GetAccessorDeclaration(); 2949getAccessor = getAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2951var setAccessor = (AccessorDeclarationSyntax)Generator.SetAccessorDeclaration(); 2953setAccessor = setAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.InvocationExpression(Generator.IdentifierName("x")))); 2956Generator.WithAccessorDeclarations( 2957Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 2960VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2974TestRemoveAllMembers(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2975TestRemoveAllMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2976TestRemoveAllMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 2977TestRemoveAllMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")])); 2978TestRemoveAllMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n")])); 2979TestRemoveAllMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n")])); 2981TestRemoveMember(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2982TestRemoveMember(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2986=> Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count); 2990var newDecl = Generator.RemoveNode(declaration, Generator.GetMembers(declaration).First(m => Generator.GetName(m) == name)); 2997AssertMemberNamesEqual("m", Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2998AssertMemberNamesEqual("m", Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2999AssertMemberNamesEqual("m", Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 3000AssertMemberNamesEqual("v", Generator.EnumDeclaration("e", members: [Generator.EnumMember("v")])); 3001AssertMemberNamesEqual("c", Generator.NamespaceDeclaration("n", declarations: [Generator.ClassDeclaration("c")])); 3002AssertMemberNamesEqual("c", Generator.CompilationUnit(declarations: [Generator.ClassDeclaration("c")])); 3008Assert.Equal(DeclarationKind.CompilationUnit, Generator.GetDeclarationKind(Generator.CompilationUnit())); 3009Assert.Equal(DeclarationKind.Class, Generator.GetDeclarationKind(Generator.ClassDeclaration("c"))); 3010Assert.Equal(DeclarationKind.Struct, Generator.GetDeclarationKind(Generator.StructDeclaration("s"))); 3011Assert.Equal(DeclarationKind.Interface, Generator.GetDeclarationKind(Generator.InterfaceDeclaration("i"))); 3012Assert.Equal(DeclarationKind.Enum, Generator.GetDeclarationKind(Generator.EnumDeclaration("e"))); 3013Assert.Equal(DeclarationKind.Delegate, Generator.GetDeclarationKind(Generator.DelegateDeclaration("d"))); 3014Assert.Equal(DeclarationKind.Method, Generator.GetDeclarationKind(Generator.MethodDeclaration("m"))); 3015Assert.Equal(DeclarationKind.Constructor, Generator.GetDeclarationKind(Generator.ConstructorDeclaration())); 3016Assert.Equal(DeclarationKind.Parameter, Generator.GetDeclarationKind(Generator.ParameterDeclaration("p"))); 3017Assert.Equal(DeclarationKind.Property, Generator.GetDeclarationKind(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 3018Assert.Equal(DeclarationKind.Indexer, Generator.GetDeclarationKind(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 3019Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 3020Assert.Equal(DeclarationKind.EnumMember, Generator.GetDeclarationKind(Generator.EnumMember("v"))); 3021Assert.Equal(DeclarationKind.Event, Generator.GetDeclarationKind(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 3022Assert.Equal(DeclarationKind.CustomEvent, Generator.GetDeclarationKind(Generator.CustomEventDeclaration("e", Generator.IdentifierName("t")))); 3023Assert.Equal(DeclarationKind.Namespace, Generator.GetDeclarationKind(Generator.NamespaceDeclaration("n"))); 3024Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))); 3025Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3026Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(Generator.Attribute("a"))); 3032Assert.Equal("c", Generator.GetName(Generator.ClassDeclaration("c"))); 3033Assert.Equal("s", Generator.GetName(Generator.StructDeclaration("s"))); 3034Assert.Equal("i", Generator.GetName(Generator.EnumDeclaration("i"))); 3035Assert.Equal("e", Generator.GetName(Generator.EnumDeclaration("e"))); 3036Assert.Equal("d", Generator.GetName(Generator.DelegateDeclaration("d"))); 3037Assert.Equal("m", Generator.GetName(Generator.MethodDeclaration("m"))); 3038Assert.Equal("", Generator.GetName(Generator.ConstructorDeclaration())); 3039Assert.Equal("p", Generator.GetName(Generator.ParameterDeclaration("p"))); 3040Assert.Equal("p", Generator.GetName(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 3041Assert.Equal("", Generator.GetName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 3042Assert.Equal("f", Generator.GetName(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 3043Assert.Equal("v", Generator.GetName(Generator.EnumMember("v"))); 3044Assert.Equal("ef", Generator.GetName(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 3045Assert.Equal("ep", Generator.GetName(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")))); 3046Assert.Equal("n", Generator.GetName(Generator.NamespaceDeclaration("n"))); 3047Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))); 3048Assert.Equal("loc", Generator.GetName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3049Assert.Equal("a", Generator.GetName(Generator.Attribute("a"))); 3055Assert.Equal("c", Generator.GetName(Generator.WithName(Generator.ClassDeclaration("x"), "c"))); 3056Assert.Equal("s", Generator.GetName(Generator.WithName(Generator.StructDeclaration("x"), "s"))); 3057Assert.Equal("i", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "i"))); 3058Assert.Equal("e", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "e"))); 3059Assert.Equal("d", Generator.GetName(Generator.WithName(Generator.DelegateDeclaration("x"), "d"))); 3060Assert.Equal("m", Generator.GetName(Generator.WithName(Generator.MethodDeclaration("x"), "m"))); 3061Assert.Equal("", Generator.GetName(Generator.WithName(Generator.ConstructorDeclaration(), ".ctor"))); 3062Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.ParameterDeclaration("x"), "p"))); 3063Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p"))); 3064Assert.Equal("", Generator.GetName(Generator.WithName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), "this"))); 3065Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f"))); 3066Assert.Equal("v", Generator.GetName(Generator.WithName(Generator.EnumMember("x"), "v"))); 3067Assert.Equal("ef", Generator.GetName(Generator.WithName(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef"))); 3068Assert.Equal("ep", Generator.GetName(Generator.WithName(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep"))); 3069Assert.Equal("n", Generator.GetName(Generator.WithName(Generator.NamespaceDeclaration("x"), "n"))); 3070Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))); 3071Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc"))); 3072Assert.Equal("a", Generator.GetName(Generator.WithName(Generator.Attribute("x"), "a"))); 3078Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal))); 3079Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal))); 3080Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal))); 3081Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal))); 3082Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal))); 3083Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal))); 3084Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal))); 3085Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.ParameterDeclaration("p"))); 3086Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3087Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3088Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3089Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.EnumMember("v"))); 3090Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3091Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3092Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceDeclaration("n"))); 3093Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))); 3094Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3095Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.Attribute("a"))); 3096Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(TypeParameter("tp"))); 3102Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal), Accessibility.Private))); 3103Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal), Accessibility.Private))); 3104Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal), Accessibility.Private))); 3105Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal), Accessibility.Private))); 3106Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal), Accessibility.Private))); 3107Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal), Accessibility.Private))); 3108Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal), Accessibility.Private))); 3109Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private))); 3110Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3111Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3112Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3113Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private))); 3114Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3115Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3116Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private))); 3117Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))); 3118Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private))); 3119Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private))); 3120Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(TypeParameter("tp"), Accessibility.Private))); 3121Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(AccessorDeclaration(SyntaxKind.InitAccessorDeclaration), Accessibility.Private))); 3127Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.ClassDeclaration("c", modifiers: DeclarationModifiers.Abstract))); 3128Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.StructDeclaration("s", modifiers: DeclarationModifiers.Partial))); 3129Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.EnumDeclaration("e", modifiers: DeclarationModifiers.New))); 3130Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New))); 3131Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Static))); 3132Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.ConstructorDeclaration(modifiers: DeclarationModifiers.Static))); 3133Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.ParameterDeclaration("p"))); 3134Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3135Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3136Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Const))); 3137Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3138Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3139Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.EnumMember("v"))); 3140Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceDeclaration("n"))); 3141Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))); 3142Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3143Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.Attribute("a"))); 3144Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(TypeParameter("tp"))); 3150Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), DeclarationModifiers.Abstract))); 3151Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), DeclarationModifiers.Partial))); 3152Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), DeclarationModifiers.New))); 3153Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), DeclarationModifiers.New))); 3154Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), DeclarationModifiers.Static))); 3155Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration(), DeclarationModifiers.Static))); 3156Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.ParameterDeclaration("p"), DeclarationModifiers.Abstract))); 3157Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3158Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3159Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), DeclarationModifiers.Const))); 3160Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3161Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3162Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumMember("v"), DeclarationModifiers.Partial))); 3163Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceDeclaration("n"), DeclarationModifiers.Abstract))); 3164Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract))); 3165Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract))); 3166Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.Attribute("a"), DeclarationModifiers.Abstract))); 3167Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(TypeParameter("tp"), DeclarationModifiers.Abstract))); 3177Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), allModifiers))); 3181Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), allModifiers))); 3185Generator.GetModifiers(Generator.WithModifiers(Generator.InterfaceDeclaration("i"), allModifiers))); 3189Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), allModifiers))); 3193Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), allModifiers))); 3197Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), allModifiers))); 3201Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration("c"), allModifiers))); 3205Generator.GetModifiers(Generator.WithModifiers(DestructorDeclaration("c"), allModifiers))); 3209Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), allModifiers))); 3213Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), allModifiers))); 3217Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), allModifiers))); 3221Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), allModifiers))); 3225Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), allModifiers))); 3229Generator.GetModifiers(Generator.WithModifiers(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration), allModifiers))); 3235var ctor = Generator.ConstructorDeclaration("C", modifiers: DeclarationModifiers.Static); 3242var publicCtor = Generator.WithAccessibility(ctor, Accessibility.Public); 3253var ctor = Generator.ConstructorDeclaration("C", accessibility: Accessibility.Public); 3260var staticCtor = Generator.WithModifiers(ctor, DeclarationModifiers.Static); 3272var fileAbstractClass = Generator.WithModifiers(fileClass, Generator.GetModifiers(fileClass).WithIsAbstract(true)); 3284var filePublicClass = Generator.WithAccessibility(fileClass, Accessibility.Public); 3296var fileAbstractClass = Generator.WithModifiers(abstractClass, Generator.GetModifiers(abstractClass).WithIsFile(true)); 3308var filePublicClass = Generator.WithModifiers(publicClass, Generator.GetModifiers(publicClass).WithIsFile(true)); 3320var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3328var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsVirtual(true)); 3338var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3345Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))).ToString()); 3346Assert.Null(Generator.GetType(Generator.MethodDeclaration("m"))); 3348Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()); 3349Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3350Assert.Equal("t", Generator.GetType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("t"))).ToString()); 3351Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3353Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()); 3354Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()); 3356Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType: Generator.IdentifierName("t"))).ToString()); 3357Assert.Null(Generator.GetType(Generator.DelegateDeclaration("d"))); 3359Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()); 3361Assert.Null(Generator.GetType(Generator.ClassDeclaration("c"))); 3362Assert.Null(Generator.GetType(Generator.IdentifierName("x"))); 3368Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3369Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3370Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3371Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3372Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3374Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()); 3376Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3377Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3379Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()); 3380Assert.Null(Generator.GetType(Generator.WithType(Generator.ClassDeclaration("c"), Generator.IdentifierName("t")))); 3381Assert.Null(Generator.GetType(Generator.WithType(Generator.IdentifierName("x"), Generator.IdentifierName("t")))); 3387Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count); 3388Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3389Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3391Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count); 3392Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3393Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3395Assert.Equal(1, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("t"))).Count); 3396Assert.Equal(2, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))], Generator.IdentifierName("t"))).Count); 3398Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3399Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3401Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3402Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3404Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count); 3405Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3407Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count); 3408Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count); 3414Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3415Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3416Assert.Equal(3, Generator.GetParameters(Generator.AddParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("t")), [Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")), Generator.ParameterDeclaration("p3", Generator.IdentifierName("t3"))])).Count); 3418Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3419Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3421Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3423Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3424Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3425Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3426Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3433Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3434Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3435Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString()); 3438Assert.Null(Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]))); 3439Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")])).Count); 3440Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3441Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3442Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3443Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3446Assert.Null(Generator.GetExpression(Generator.IdentifierName("e"))); 3449var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3451method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3453Assert.Equal("x", Generator.GetExpression(method).ToString()); 3458local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3460Assert.Equal("x", Generator.GetExpression(local).ToString()); 3467Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3468Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3469Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()); 3472Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3473Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3474Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3475Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3476Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3477Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3478Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3479Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3482Assert.Null(Generator.GetExpression(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x")))); 3485var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3487method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3489Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString()); 3494local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3496Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString()); 3502var prop = Generator.PropertyDeclaration("p", Generator.IdentifierName("T")); 3504Assert.Equal(2, Generator.GetAccessors(prop).Count); 3507var getAccessor = Generator.GetAccessor(prop, DeclarationKind.GetAccessor); 3513Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(getAccessor)); 3516var setAccessor = Generator.GetAccessor(prop, DeclarationKind.SetAccessor); 3518Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(setAccessor)); 3521Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, getAccessor), DeclarationKind.GetAccessor)); 3522Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, setAccessor), DeclarationKind.SetAccessor)); 3525Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.WithAccessibility(getAccessor, Accessibility.Public))); 3526Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(setAccessor, Accessibility.Private))); 3529Assert.Equal(0, Generator.GetStatements(getAccessor).Count); 3530Assert.Equal(0, Generator.GetStatements(setAccessor).Count); 3532var newGetAccessor = Generator.WithStatements(getAccessor, null); 3536var newNewGetAccessor = Generator.WithStatements(newGetAccessor, []); 3545var newProp = Generator.ReplaceNode(prop, getAccessor, Generator.WithAccessibility(getAccessor, Accessibility.Public)); 3546Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.GetAccessor))); 3548newProp = Generator.ReplaceNode(prop, setAccessor, Generator.WithAccessibility(setAccessor, Accessibility.Public)); 3549Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.SetAccessor))); 3556Generator.WithAccessorDeclarations(Generator.PropertyDeclaration("p", Generator.IdentifierName("x"))), 3560Generator.WithAccessorDeclarations( 3561Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3562Generator.GetAccessorDeclaration(Accessibility.NotApplicable, [Generator.ReturnStatement()])), 3566Generator.WithAccessorDeclarations( 3567Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3568Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3572Generator.WithAccessorDeclarations( 3573Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3574Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3578Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x"))), 3582Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3583Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3587Generator.WithAccessorDeclarations( 3588Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3589Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3604var x = Generator.GetMembers(root.Members[0])[0]; 3605var y = Generator.GetMembers(root.Members[0])[1]; 3607Assert.Equal(2, Generator.GetAccessors(x).Count); 3608Assert.Equal(0, Generator.GetAccessors(y).Count); 3611var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3613Assert.Equal(0, Generator.GetAccessors(y2).Count); 3627var x = Generator.GetMembers(root.Members[0])[0]; 3628var y = Generator.GetMembers(root.Members[0])[1]; 3630Assert.Equal(2, Generator.GetAccessors(x).Count); 3631Assert.Equal(0, Generator.GetAccessors(y).Count); 3634var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3636Assert.Equal(0, Generator.GetAccessors(y2).Count); 3652var x = Generator.GetMembers(root.Members[0])[0]; 3653var y = Generator.GetMembers(root.Members[0])[1]; 3654var z = Generator.GetMembers(root.Members[0])[2]; 3656Assert.NotNull(Generator.GetExpression(x)); 3657Assert.NotNull(Generator.GetExpression(y)); 3658Assert.Null(Generator.GetExpression(z)); 3659Assert.Equal("100", Generator.GetExpression(x).ToString()); 3660Assert.Equal("300", Generator.GetExpression(y).ToString()); 3662Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString()); 3663Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3664Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString()); 3679var x = Generator.GetMembers(root.Members[0])[0]; 3680var y = Generator.GetMembers(root.Members[0])[1]; 3682Assert.Null(Generator.GetExpression(x)); 3683Assert.NotNull(Generator.GetExpression(y)); 3684Assert.Equal("p * 10", Generator.GetExpression(y).ToString()); 3686Assert.Null(Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500)))); 3687Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3696Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3699Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3702Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count); 3703Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements: stmts)).Count); 3705Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count); 3706Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements: stmts)).Count); 3708Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression([])).Count); 3709Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count); 3711Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression([])).Count); 3712Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count); 3714Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count); 3723Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3726Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3729Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count); 3730Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count); 3731Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression([]), stmts)).Count); 3732Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression([]), stmts)).Count); 3734Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count); 3743Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3746Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3749var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3752Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3753Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3755Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3756Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3758Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count); 3761Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3762Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3764Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3765Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3767Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count); 3776Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3779Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3782var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3785Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3786Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3787Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3790Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3791Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3792Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3805var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3818var baseListB = Generator.GetBaseAndInterfaceTypes(classB); 3830var baseListN = Generator.GetBaseAndInterfaceTypes(classN); 3845var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3849Generator.RemoveNode(classBI, baseListBI[0]), 3857Generator.RemoveNode(classBI, baseListBI[1]), 3865Generator.RemoveNodes(classBI, baseListBI), 3898Generator.AddBaseType(classC, Generator.IdentifierName("T")), 3906Generator.AddBaseType(classCI, Generator.IdentifierName("T")), 3915Generator.AddBaseType(classCB, Generator.IdentifierName("T")), 3948Generator.AddInterfaceType(classC, Generator.IdentifierName("T")), 3956Generator.AddInterfaceType(classCI, Generator.IdentifierName("T")), 3964Generator.AddInterfaceType(classCB, Generator.IdentifierName("T")), 3988var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3989var declX = Generator.GetDeclaration(symbolX.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3990var declY = Generator.GetDeclaration(symbolY.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3991var declZ = Generator.GetDeclaration(symbolZ.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3993Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declX)); 3994Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declY)); 3995Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declZ)); 3997Assert.NotNull(Generator.GetType(declX)); 3998Assert.Equal("int", Generator.GetType(declX).ToString()); 3999Assert.Equal("X", Generator.GetName(declX)); 4000Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declX)); 4001Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declX)); 4003Assert.NotNull(Generator.GetType(declY)); 4004Assert.Equal("int", Generator.GetType(declY).ToString()); 4005Assert.Equal("Y", Generator.GetName(declY)); 4006Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declY)); 4007Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declY)); 4009Assert.NotNull(Generator.GetType(declZ)); 4010Assert.Equal("int", Generator.GetType(declZ).ToString()); 4011Assert.Equal("Z", Generator.GetName(declZ)); 4012Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declZ)); 4013Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declZ)); 4015var xTypedT = Generator.WithType(declX, Generator.IdentifierName("T")); 4016Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xTypedT)); 4018Assert.Equal("T", Generator.GetType(xTypedT).ToString()); 4020var xNamedQ = Generator.WithName(declX, "Q"); 4021Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xNamedQ)); 4023Assert.Equal("Q", Generator.GetName(xNamedQ).ToString()); 4025var xInitialized = Generator.WithExpression(declX, Generator.IdentifierName("e")); 4026Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xInitialized)); 4028Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()); 4030var xPrivate = Generator.WithAccessibility(declX, Accessibility.Private); 4031Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xPrivate)); 4033Assert.Equal(Accessibility.Private, Generator.GetAccessibility(xPrivate)); 4035var xReadOnly = Generator.WithModifiers(declX, DeclarationModifiers.ReadOnly); 4036Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xReadOnly)); 4038Assert.Equal(DeclarationModifiers.ReadOnly, Generator.GetModifiers(xReadOnly)); 4040var xAttributed = Generator.AddAttributes(declX, Generator.Attribute("A")); 4041Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xAttributed)); 4043Assert.Equal(1, Generator.GetAttributes(xAttributed).Count); 4044Assert.Equal("[A]", Generator.GetAttributes(xAttributed)[0].ToString()); 4046var membersC = Generator.GetMembers(declC); 4053Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4063Generator.InsertMembers(declC, 1, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4074Generator.InsertMembers(declC, 2, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4085Generator.InsertMembers(declC, 3, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4095Generator.ClassDeclaration("C", members: [declX, declY]), 4105Generator.ReplaceNode(declC, declX, xTypedT), 4115Generator.ReplaceNode(declC, declY, Generator.WithType(declY, Generator.IdentifierName("T"))), 4126Generator.ReplaceNode(declC, declZ, Generator.WithType(declZ, Generator.IdentifierName("T"))), 4136Generator.ReplaceNode(declC, declX, Generator.WithAccessibility(declX, Accessibility.Private)), 4146Generator.ReplaceNode(declC, declX, Generator.WithModifiers(declX, DeclarationModifiers.None)), 4155Generator.ReplaceNode(declC, declX, Generator.WithName(declX, "Q")), 4163Generator.ReplaceNode(declC, declX.GetAncestorOrThis<VariableDeclaratorSyntax>(), VariableDeclarator("Q")), 4172Generator.ReplaceNode(declC, declX, Generator.WithExpression(declX, Generator.IdentifierName("e"))), 4192var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4195Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4213var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4216Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4237var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4240Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4258var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4261Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4279var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4282Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4300var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4303Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4321var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4324Generator.InsertMembers(declC, 0, Generator.EnumMember("A")), 4342var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4345Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4363var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4366Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4387var attrs = Generator.GetAttributes(declC); 4394Assert.Equal("X", Generator.GetName(attrX)); 4395Assert.Equal("Y", Generator.GetName(attrY)); 4396Assert.Equal("Z", Generator.GetName(attrZ)); 4398var xNamedQ = Generator.WithName(attrX, "Q"); 4399Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4403var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4404Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4410Generator.InsertAttributes(declC, 0, Generator.Attribute("A")), 4420Generator.InsertAttributes(declC, 1, Generator.Attribute("A")), 4431Generator.InsertAttributes(declC, 2, Generator.Attribute("A")), 4442Generator.InsertAttributes(declC, 3, Generator.Attribute("A")), 4453Generator.RemoveNodes(declC, [attrX]), 4462Generator.RemoveNodes(declC, [attrY]), 4471Generator.RemoveNodes(declC, [attrZ]), 4480Generator.RemoveNodes(declC, [attrX, attrY]), 4489Generator.RemoveNodes(declC, [attrX, attrZ]), 4498Generator.RemoveNodes(declC, [attrY, attrZ]), 4507Generator.RemoveNodes(declC, [attrX, attrY, attrZ]), 4516Generator.ReplaceNode(declC, attrX, Generator.Attribute("A")), 4525Generator.ReplaceNode(declC, attrY, Generator.Attribute("A")), 4534Generator.ReplaceNode(declC, attrZ, Generator.Attribute("A")), 4543Generator.ReplaceNode(declC, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4571Generator.MethodDeclaration(method), 4575Generator.IndexerDeclaration(indexer), 4579Generator.PropertyDeclaration(property), 4598var declM = Generator.GetMembers(declC).First(); 4600Assert.Equal(0, Generator.GetAttributes(declM).Count); 4602var attrs = Generator.GetReturnAttributes(declM); 4608Assert.Equal("X", Generator.GetName(attrX)); 4609Assert.Equal("Y", Generator.GetName(attrY)); 4610Assert.Equal("Z", Generator.GetName(attrZ)); 4612var xNamedQ = Generator.WithName(attrX, "Q"); 4613Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4617var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4618Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4624Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("A")), 4634Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("A")), 4645Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("A")), 4656Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("A")), 4667Generator.ReplaceNode(declM, attrX, Generator.Attribute("Q")), 4676Generator.ReplaceNode(declM, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4704var declM = Generator.GetMembers(declC).First(); 4706var attrs = Generator.GetAttributes(declM); 4710Assert.Equal("X", Generator.GetName(attrX)); 4714Assert.Equal("Y", Generator.GetName(attrY)); 4718Assert.Equal("Z", Generator.GetName(attrZ)); 4722Assert.Equal("P", Generator.GetName(attrP)); 4725var rattrs = Generator.GetReturnAttributes(declM); 4729Assert.Equal("A", Generator.GetName(attrA)); 4733Assert.Equal("B", Generator.GetName(attrB)); 4737Assert.Equal("C", Generator.GetName(attrC)); 4741Assert.Equal("D", Generator.GetName(attrD)); 4746Generator.InsertAttributes(declM, 0, Generator.Attribute("Q")), 4760Generator.InsertAttributes(declM, 1, Generator.Attribute("Q")), 4774Generator.InsertAttributes(declM, 2, Generator.Attribute("Q")), 4789Generator.InsertAttributes(declM, 3, Generator.Attribute("Q")), 4803Generator.InsertAttributes(declM, 4, Generator.Attribute("Q")), 4817Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("Q")), 4831Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("Q")), 4845Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("Q")), 4860Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("Q")), 4875Generator.InsertReturnAttributes(declM, 4, Generator.Attribute("Q")), 4900var newDecl = Generator.AddInterfaceType(decl, Generator.IdentifierName("IDisposable")); 4920Generator.Declaration(symbolR), 4935Generator.Declaration(symbolR), 4958Generator.Declaration(symbolR), 4973Generator.Declaration(symbolR), 4996Generator.Declaration(symbol), 5016Generator.Declaration(symbol), 5034Generator.Declaration(symbol), 5051Generator.Declaration(symbol), 5076Generator.Declaration(symbol), 5221Generator.Declaration(symbol), 5279Generator.Attribute(attribute), 5287Generator.TypeExpression(type), 5309VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5338VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5365VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5391Assert.Throws<ArgumentException>(() => Generator.Declaration(symbol)); 5411VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5440VerifySyntax<StructDeclarationSyntax>(Generator.Declaration(symbol), 5473VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5503VerifySyntax<ExtensionBlockDeclarationSyntax>(Generator.Declaration(symbol), 5532VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5568VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5604VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5634VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5659VerifySyntax<ClassDeclarationSyntax>(Generator.Declaration(symbol), 5719var generator = this.Generator;