2418 references to Generator
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2418)
CodeGeneration\SyntaxGeneratorTests.cs (2418)
67VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0), "0"); 68VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1), "1"); 69VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1), "-1"); 70VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MinValue), "global::System.Int32.MinValue"); 71VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MaxValue), "global::System.Int32.MaxValue"); 73VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0L), "0L"); 74VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1L), "1L"); 75VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1L), "-1L"); 76VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MinValue), "global::System.Int64.MinValue"); 77VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MaxValue), "global::System.Int64.MaxValue"); 79VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0UL), "0UL"); 80VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1UL), "1UL"); 81VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ulong.MinValue), "0UL"); 82VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ulong.MaxValue), "global::System.UInt64.MaxValue"); 84VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0f), "0F"); 85VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0f), "1F"); 86VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0f), "-1F"); 87VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MinValue), "global::System.Single.MinValue"); 88VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MaxValue), "global::System.Single.MaxValue"); 89VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.Epsilon), "global::System.Single.Epsilon"); 90VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NaN), "global::System.Single.NaN"); 91VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NegativeInfinity), "global::System.Single.NegativeInfinity"); 92VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.PositiveInfinity), "global::System.Single.PositiveInfinity"); 94VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0), "0D"); 95VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0), "1D"); 96VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0), "-1D"); 97VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MinValue), "global::System.Double.MinValue"); 98VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MaxValue), "global::System.Double.MaxValue"); 99VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.Epsilon), "global::System.Double.Epsilon"); 100VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NaN), "global::System.Double.NaN"); 101VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NegativeInfinity), "global::System.Double.NegativeInfinity"); 102VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.PositiveInfinity), "global::System.Double.PositiveInfinity"); 104VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0m), "0M"); 105VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.00m), "0.00M"); 106VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.00m), "1.00M"); 107VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.00m), "-1.00M"); 108VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0000000000m), "1.0000000000M"); 109VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.000000m), "0.000000M"); 110VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0000000m), "0.0000000M"); 111VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1000000000m), "1000000000M"); 112VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(123456789.123456789m), "123456789.123456789M"); 113VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-28m), "0.0000000000000000000000000001M"); 114VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0E-28m), "0.0000000000000000000000000000M"); 115VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-29m), "0.0000000000000000000000000000M"); 116VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(-1E-29m), "0.0000000000000000000000000000M"); 117VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MinValue), "global::System.Decimal.MinValue"); 118VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MaxValue), "global::System.Decimal.MaxValue"); 120VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression('c'), "'c'"); 122VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("str"), "\"str\""); 123VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("s\"t\"r"), "\"s\\\"t\\\"r\""); 125VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(true), "true"); 126VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(false), "false"); 132VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)0), "0"); 133VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)1), "1"); 134VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((short)-1), "-1"); 135VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MinValue), "global::System.Int16.MinValue"); 136VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MaxValue), "global::System.Int16.MaxValue"); 142VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)0), "0"); 143VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)1), "1"); 144VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ushort.MinValue), "0"); 145VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ushort.MaxValue), "global::System.UInt16.MaxValue"); 151VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)0), "0"); 152VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)1), "1"); 153VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((sbyte)-1), "-1"); 154VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MinValue), "global::System.SByte.MinValue"); 155VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MaxValue), "global::System.SByte.MaxValue"); 161VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)0), "0"); 162VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)1), "1"); 163VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MinValue), "0"); 164VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MaxValue), "255"); 170VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 176VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 182VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 188VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 194VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 200VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 207VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 213VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 219VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 225var attributes = Generator.GetAttributes(Generator.AddAttributes( 226Generator.NamespaceDeclaration("n"), 227Generator.Attribute("Attr"))); 241VerifySyntax<IdentifierNameSyntax>(Generator.IdentifierName("x"), "x"); 242VerifySyntax<QualifiedNameSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 243VerifySyntax<QualifiedNameSyntax>(Generator.DottedName("x.y"), "x.y"); 245VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 246VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 249VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x<y>"); 252VerifySyntax<QualifiedNameSyntax>(Generator.WithTypeArguments(Generator.DottedName("x.y"), Generator.IdentifierName("z")), "x.y<z>"); 255VerifySyntax<MemberAccessExpressionSyntax>(Generator.WithTypeArguments(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y<z>"); 258var gname = Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")); 260VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(gname, Generator.IdentifierName("z")), "x<z>"); 267VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 268VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 269VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 270VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 271VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 273VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 274VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 275VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 276VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 279VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x")), "x"); 280VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x"), "y"), "x y"); 281VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType), "global::System.Int32"); 282VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType, "y"), "global::System.Int32 y"); 283VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 284VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 285VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, new[] { "x", "y" }), "(global::System.Int32 x, global::System.Int32 y)"); 291VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 292VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 294VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 295VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 297VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 298VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 300VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 301VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 303VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 304VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 306VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 307VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 309VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 310VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 317VerifySyntax<QualifiedNameSyntax>(Generator.TypeExpression(genericType), "global::System.Collections.Generic.IEnumerable<T>"); 320VerifySyntax<ArrayTypeSyntax>(Generator.TypeExpression(arrayType), "global::System.Int32[]"); 326VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.NegateExpression(Generator.IdentifierName("x")), "-(x)"); 327VerifySyntax<BinaryExpressionSyntax>(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) + (y)"); 328VerifySyntax<BinaryExpressionSyntax>(Generator.SubtractExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) - (y)"); 329VerifySyntax<BinaryExpressionSyntax>(Generator.MultiplyExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) * (y)"); 330VerifySyntax<BinaryExpressionSyntax>(Generator.DivideExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) / (y)"); 331VerifySyntax<BinaryExpressionSyntax>(Generator.ModuloExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) % (y)"); 333VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.BitwiseNotExpression(Generator.IdentifierName("x")), "~(x)"); 334VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) & (y)"); 335VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) | (y)"); 337VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LogicalNotExpression(Generator.IdentifierName("x")), "!(x)"); 338VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) && (y)"); 339VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) || (y)"); 345VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 346VerifySyntax<BinaryExpressionSyntax>(Generator.ValueEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 348VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 349VerifySyntax<BinaryExpressionSyntax>(Generator.ValueNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 351VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) < (y)"); 352VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) <= (y)"); 354VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) > (y)"); 355VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) >= (y)"); 361VerifySyntax<BinaryExpressionSyntax>(Generator.CoalesceExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) ?? (y)"); 362VerifySyntax<ConditionalExpressionSyntax>(Generator.ConditionalExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "(x) ? (y) : (z)"); 368VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 369VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), "y"), "x.y"); 370VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y.z"); 371VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x(y).z"); 372VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x[y].z"); 373VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "((x) + (y)).z"); 374VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.NegateExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y")), "(-(x)).y"); 381Generator.ArrayCreationExpression(Generator.IdentifierName("x"), Generator.LiteralExpression(10)), 385Generator.ArrayCreationExpression(Generator.IdentifierName("x"), new SyntaxNode[] { Generator.IdentifierName("y"), Generator.IdentifierName("z") }), 399Generator.ObjectCreationExpression(Generator.IdentifierName("x")), 403Generator.ObjectCreationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 411Generator.ObjectCreationExpression(listOfIntType, Generator.IdentifierName("y")), 419Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 423Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), 427Generator.ElementAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 431Generator.ElementAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 435Generator.ElementAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 439Generator.ElementAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 446VerifySyntax<CastExpressionSyntax>(Generator.CastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 447VerifySyntax<CastExpressionSyntax>(Generator.ConvertExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 453VerifySyntax<BinaryExpressionSyntax>(Generator.IsTypeExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) is y"); 454VerifySyntax<BinaryExpressionSyntax>(Generator.TryCastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) as y"); 455VerifySyntax<TypeOfExpressionSyntax>(Generator.TypeOfExpression(Generator.IdentifierName("x")), "typeof(x)"); 462VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x")), "x()"); 463VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x(y)"); 464VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x(y, z)"); 467VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(Generator.IdentifierName("y"))), "x(y)"); 468VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 469VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 472VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x.y()"); 473VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x[y]()"); 474VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x(y)()"); 475VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "((x) + (y))()"); 480=> VerifySyntax<AssignmentExpressionSyntax>(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x = (y)"); 485VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.IdentifierName("x")), "x;"); 486VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("x"))), "x();"); 492VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y"), "x y;"); 493VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;"); 495VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", isConst: true), "const x y;"); 496VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;"); 498VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement("y", Generator.IdentifierName("z")), "var y = z;"); 505Generator.AddEventHandler(Generator.IdentifierName("@event"), Generator.IdentifierName("handler")), 513Generator.RemoveEventHandler(Generator.IdentifierName("@event"), 514Generator.IdentifierName("handler")), "@event -= (handler)"); 519=> VerifySyntax<AwaitExpressionSyntax>(Generator.AwaitExpression(Generator.IdentifierName("x")), "await x"); 523=> VerifySyntax<InvocationExpressionSyntax>(Generator.NameOfExpression(Generator.IdentifierName("x")), "nameof(x)"); 528VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression( 529new[] { Generator.IdentifierName("x"), Generator.IdentifierName("y") }), "(x, y)"); 531VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression( 532new[] { Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 533Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y")) }), "(goo: x, bar: y)"); 539VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(), "return;"); 540VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(Generator.IdentifierName("x")), "return x;"); 546VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.LiteralExpression(1)), "yield return 1;"); 547VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.IdentifierName("x")), "yield return x;"); 553VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(), "throw;"); 554VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(Generator.IdentifierName("x")), "throw x;"); 561Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }), 565Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }, new SyntaxNode[] { }), 569Generator.IfStatement(Generator.IdentifierName("x"), 570new SyntaxNode[] { Generator.IdentifierName("y") }), 574Generator.IfStatement(Generator.IdentifierName("x"), 575new SyntaxNode[] { Generator.IdentifierName("y") }, 576new SyntaxNode[] { Generator.IdentifierName("z") }), 580Generator.IfStatement(Generator.IdentifierName("x"), 581new SyntaxNode[] { Generator.IdentifierName("y") }, 582Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") })), 586Generator.IfStatement(Generator.IdentifierName("x"), 587new SyntaxNode[] { Generator.IdentifierName("y") }, 588Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") }, Generator.IdentifierName("z"))), 596Generator.SwitchStatement(Generator.IdentifierName("x"), 597Generator.SwitchSection(Generator.IdentifierName("y"), 598new[] { Generator.IdentifierName("z") })), 602Generator.SwitchStatement(Generator.IdentifierName("x"), 603Generator.SwitchSection( 604new[] { Generator.IdentifierName("y"), Generator.IdentifierName("p"), Generator.IdentifierName("q") }, 605new[] { Generator.IdentifierName("z") })), 609Generator.SwitchStatement(Generator.IdentifierName("x"), 610Generator.SwitchSection(Generator.IdentifierName("y"), 611new[] { Generator.IdentifierName("z") }), 612Generator.SwitchSection(Generator.IdentifierName("a"), 613new[] { Generator.IdentifierName("b") })), 617Generator.SwitchStatement(Generator.IdentifierName("x"), 618Generator.SwitchSection(Generator.IdentifierName("y"), 619new[] { Generator.IdentifierName("z") }), 620Generator.DefaultSwitchSection( 621new[] { Generator.IdentifierName("b") })), 625Generator.SwitchStatement(Generator.IdentifierName("x"), 626Generator.SwitchSection(Generator.IdentifierName("y"), 627new[] { Generator.ExitSwitchStatement() })), 631Generator.SwitchStatement(Generator.TupleExpression(new[] { Generator.IdentifierName("x1"), Generator.IdentifierName("x2") }), 632Generator.SwitchSection(Generator.IdentifierName("y"), 633new[] { Generator.IdentifierName("z") })), 642Generator.UsingStatement(Generator.IdentifierName("x"), new[] { Generator.IdentifierName("y") }), 646Generator.UsingStatement("x", Generator.IdentifierName("y"), new[] { Generator.IdentifierName("z") }), 650Generator.UsingStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), new[] { Generator.IdentifierName("q") }), 658Generator.LockStatement(Generator.IdentifierName("x"), new[] { Generator.IdentifierName("y") }), 666Generator.TryCatchStatement( 667new[] { Generator.IdentifierName("x") }, 668Generator.CatchClause(Generator.IdentifierName("y"), "z", 669new[] { Generator.IdentifierName("a") })), 673Generator.TryCatchStatement( 674new[] { Generator.IdentifierName("s") }, 675Generator.CatchClause(Generator.IdentifierName("x"), "y", 676new[] { Generator.IdentifierName("z") }), 677Generator.CatchClause(Generator.IdentifierName("a"), "b", 678new[] { Generator.IdentifierName("c") })), 682Generator.TryCatchStatement( 683new[] { Generator.IdentifierName("s") }, 684new[] { Generator.CatchClause(Generator.IdentifierName("x"), "y", new[] { Generator.IdentifierName("z") }) }, 685new[] { Generator.IdentifierName("a") }), 689Generator.TryFinallyStatement( 690new[] { Generator.IdentifierName("x") }, 691new[] { Generator.IdentifierName("a") }), 699Generator.WhileStatement(Generator.IdentifierName("x"), 700new[] { Generator.IdentifierName("y") }), 704Generator.WhileStatement(Generator.IdentifierName("x"), null), 712Generator.ValueReturningLambdaExpression("x", Generator.IdentifierName("y")), 716Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 720Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 724Generator.VoidReturningLambdaExpression("x", Generator.IdentifierName("y")), 728Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 732Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 736Generator.ValueReturningLambdaExpression("x", new[] { Generator.ReturnStatement(Generator.IdentifierName("y")) }), 740Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, new[] { Generator.ReturnStatement(Generator.IdentifierName("z")) }), 744Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, new[] { Generator.ReturnStatement(Generator.IdentifierName("y")) }), 748Generator.VoidReturningLambdaExpression("x", new[] { Generator.IdentifierName("y") }), 752Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, new[] { Generator.IdentifierName("z") }), 756Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, new[] { Generator.IdentifierName("y") }), 760Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 764Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 768Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 772Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 782Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32)), 786Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer: Generator.LiteralExpression(0)), 790Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public), 794Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Static | DeclarationModifiers.ReadOnly), 798Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Required), 806Generator.MethodDeclaration("m"), 810Generator.MethodDeclaration("m", typeParameters: new[] { "x", "y" }), 814Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), 818Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), statements: new[] { Generator.IdentifierName("y") }), 822Generator.MethodDeclaration("m", parameters: new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, returnType: Generator.IdentifierName("x")), 826Generator.MethodDeclaration("m", parameters: new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y"), Generator.IdentifierName("a")) }, returnType: Generator.IdentifierName("x")), 830Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public), 834Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 838Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial), 842Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial, statements: new[] { Generator.IdentifierName("y") }), 846Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial | DeclarationModifiers.Async, statements: null), 858var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 859var returnType = Generator.TypeExpression(SpecialType.System_Boolean); 862Generator.OperatorDeclaration(OperatorKind.Addition, parameters, returnType), 866Generator.OperatorDeclaration(OperatorKind.BitwiseAnd, parameters, returnType), 870Generator.OperatorDeclaration(OperatorKind.BitwiseOr, parameters, returnType), 874Generator.OperatorDeclaration(OperatorKind.Decrement, parameters, returnType), 878Generator.OperatorDeclaration(OperatorKind.Division, parameters, returnType), 882Generator.OperatorDeclaration(OperatorKind.Equality, parameters, returnType), 886Generator.OperatorDeclaration(OperatorKind.ExclusiveOr, parameters, returnType), 890Generator.OperatorDeclaration(OperatorKind.False, parameters, returnType), 894Generator.OperatorDeclaration(OperatorKind.GreaterThan, parameters, returnType), 898Generator.OperatorDeclaration(OperatorKind.GreaterThanOrEqual, parameters, returnType), 902Generator.OperatorDeclaration(OperatorKind.Increment, parameters, returnType), 906Generator.OperatorDeclaration(OperatorKind.Inequality, parameters, returnType), 910Generator.OperatorDeclaration(OperatorKind.LeftShift, parameters, returnType), 914Generator.OperatorDeclaration(OperatorKind.LessThan, parameters, returnType), 918Generator.OperatorDeclaration(OperatorKind.LessThanOrEqual, parameters, returnType), 922Generator.OperatorDeclaration(OperatorKind.LogicalNot, parameters, returnType), 926Generator.OperatorDeclaration(OperatorKind.Modulus, parameters, returnType), 930Generator.OperatorDeclaration(OperatorKind.Multiply, parameters, returnType), 934Generator.OperatorDeclaration(OperatorKind.OnesComplement, parameters, returnType), 938Generator.OperatorDeclaration(OperatorKind.RightShift, parameters, returnType), 942Generator.OperatorDeclaration(OperatorKind.UnsignedRightShift, parameters, returnType), 946Generator.OperatorDeclaration(OperatorKind.Subtraction, parameters, returnType), 950Generator.OperatorDeclaration(OperatorKind.True, parameters, returnType), 954Generator.OperatorDeclaration(OperatorKind.UnaryNegation, parameters, returnType), 958Generator.OperatorDeclaration(OperatorKind.UnaryPlus, parameters, returnType), 964Generator.OperatorDeclaration(OperatorKind.ImplicitConversion, parameters, returnType), 968Generator.OperatorDeclaration(OperatorKind.ExplicitConversion, parameters, returnType), 980Generator.Declaration(conversion), 987Generator.Declaration(conversion), 995Generator.ConstructorDeclaration(), 999Generator.ConstructorDeclaration("c"), 1003Generator.ConstructorDeclaration("c", accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static), 1007Generator.ConstructorDeclaration("c", new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }), 1011Generator.ConstructorDeclaration("c", 1012parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, 1013baseConstructorArguments: new[] { Generator.IdentifierName("p") }), 1021Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1025Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1029Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1033Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: Array.Empty<SyntaxNode>()), 1037Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1041Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: Array.Empty<SyntaxNode>()), 1045Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1049Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Required), 1053Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: new[] { Generator.IdentifierName("y") }), 1057Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: new[] { Generator.IdentifierName("y") }), 1061Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), setAccessorStatements: new[] { Generator.IdentifierName("y") }), 1065Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), getAccessorStatements: Array.Empty<SyntaxNode>(), setAccessorStatements: new[] { Generator.IdentifierName("y") }), 1073Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1077Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1081Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1085Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1089Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1093Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, 1094getAccessorStatements: new[] { Generator.IdentifierName("a") }), 1098Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, 1099setAccessorStatements: new[] { Generator.IdentifierName("a") }), 1103Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x")), 1107Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), 1108setAccessorStatements: new[] { Generator.IdentifierName("a") }), 1112Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), 1113getAccessorStatements: new[] { Generator.IdentifierName("a") }, setAccessorStatements: new[] { Generator.IdentifierName("b") }), 1121Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1125Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public), 1129Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static), 1137Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1141Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 1145Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), 1149Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), addAccessorStatements: new[] { Generator.IdentifierName("s") }, removeAccessorStatements: new[] { Generator.IdentifierName("s2") }), 1157Generator.AsPublicInterfaceImplementation( 1158Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1159Generator.IdentifierName("i")), 1163Generator.AsPublicInterfaceImplementation( 1164Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1165Generator.IdentifierName("i")), 1169Generator.AsPublicInterfaceImplementation( 1170Generator.IndexerDeclaration(parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("a")) }, type: Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1171Generator.IdentifierName("i")), 1175var pim = Generator.AsPrivateInterfaceImplementation( 1176Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1177Generator.IdentifierName("i")); 1180Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1184Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1189Generator.AsPublicInterfaceImplementation( 1220Generator.IdentifierName("i")), 1224Generator.AsPublicInterfaceImplementation( 1263Generator.IdentifierName("i")), 1267Generator.AsPublicInterfaceImplementation( 1328Generator.IdentifierName("i")), 1332Generator.AsPublicInterfaceImplementation( 1348Generator.IdentifierName("i")), 1352Generator.AsPublicInterfaceImplementation( 1373Generator.IdentifierName("i")), 1377Generator.AsPublicInterfaceImplementation( 1400Generator.IdentifierName("i")), 1404Generator.AsPublicInterfaceImplementation( 1432Generator.IdentifierName("i")), 1436Generator.AsPublicInterfaceImplementation( 1464Generator.IdentifierName("i")), 1473Generator.AsPrivateInterfaceImplementation( 1474Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1475Generator.IdentifierName("i")), 1479Generator.AsPrivateInterfaceImplementation( 1480Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1481Generator.IdentifierName("i")), 1485Generator.AsPrivateInterfaceImplementation( 1486Generator.IndexerDeclaration(parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("a")) }, type: Generator.IdentifierName("t"), accessibility: Accessibility.Protected, modifiers: DeclarationModifiers.Abstract), 1487Generator.IdentifierName("i")), 1491Generator.AsPrivateInterfaceImplementation( 1492Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1493Generator.IdentifierName("i")), 1497var pim = Generator.AsPublicInterfaceImplementation( 1498Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1499Generator.IdentifierName("i")); 1502Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1506Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1521var method = Generator.GetMembers(iface)[0]; 1523var privateMethod = Generator.AsPrivateInterfaceImplementation(method, Generator.IdentifierName("IFace")); 1534Generator.ClassDeclaration("c"), 1538Generator.ClassDeclaration("c", typeParameters: new[] { "x", "y" }), 1542Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x")), 1546Generator.ClassDeclaration("c", interfaceTypes: new[] { Generator.IdentifierName("x") }), 1550Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x"), interfaceTypes: new[] { Generator.IdentifierName("y") }), 1554Generator.ClassDeclaration("c", interfaceTypes: new SyntaxNode[] { }), 1558Generator.ClassDeclaration("c", members: new[] { Generator.FieldDeclaration("y", type: Generator.IdentifierName("x")) }), 1562Generator.ClassDeclaration("c", members: new[] { Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t")) }), 1566Generator.ClassDeclaration("c", members: new[] { Generator.ConstructorDeclaration() }), 1574Generator.StructDeclaration("s"), 1578Generator.StructDeclaration("s", typeParameters: new[] { "x", "y" }), 1582Generator.StructDeclaration("s", interfaceTypes: new[] { Generator.IdentifierName("x") }), 1586Generator.StructDeclaration("s", interfaceTypes: new[] { Generator.IdentifierName("x"), Generator.IdentifierName("y") }), 1590Generator.StructDeclaration("s", interfaceTypes: new SyntaxNode[] { }), 1594Generator.StructDeclaration("s", members: new[] { Generator.FieldDeclaration("y", Generator.IdentifierName("x")) }), 1598Generator.StructDeclaration("s", members: new[] { Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t")) }), 1602Generator.StructDeclaration("s", members: new[] { Generator.ConstructorDeclaration("xxx") }), 1610Generator.InterfaceDeclaration("i"), 1614Generator.InterfaceDeclaration("i", typeParameters: new[] { "x", "y" }), 1618Generator.InterfaceDeclaration("i", interfaceTypes: new[] { Generator.IdentifierName("a") }), 1622Generator.InterfaceDeclaration("i", interfaceTypes: new[] { Generator.IdentifierName("a"), Generator.IdentifierName("b") }), 1626Generator.InterfaceDeclaration("i", interfaceTypes: new SyntaxNode[] { }), 1630Generator.InterfaceDeclaration("i", members: new[] { Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed) }), 1634Generator.InterfaceDeclaration("i", members: new[] { Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed) }), 1638Generator.InterfaceDeclaration("i", members: new[] { Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.ReadOnly) }), 1642Generator.InterfaceDeclaration("i", members: new[] { Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("y", Generator.IdentifierName("x")) }, Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.Sealed) }), 1646Generator.InterfaceDeclaration("i", members: new[] { Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("y", Generator.IdentifierName("x")) }, Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.ReadOnly) }), 1650Generator.InterfaceDeclaration("i", members: new[] { Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static) }), 1654Generator.InterfaceDeclaration("i", members: new[] { Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static) }), 1658Generator.InterfaceDeclaration("i", members: new[] { Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed) }), 1672Generator.Declaration(symbol), 1680Generator.EnumDeclaration("e"), 1684Generator.EnumDeclaration("e", members: new[] { Generator.EnumMember("a"), Generator.EnumMember("b"), Generator.EnumMember("c") }), 1688Generator.EnumDeclaration("e", members: new[] { Generator.IdentifierName("a"), Generator.EnumMember("b"), Generator.IdentifierName("c") }), 1692Generator.EnumDeclaration("e", members: new[] { Generator.EnumMember("a", Generator.LiteralExpression(0)), Generator.EnumMember("b"), Generator.EnumMember("c", Generator.LiteralExpression(5)) }), 1696Generator.EnumDeclaration("e", members: new[] { Generator.FieldDeclaration("a", Generator.IdentifierName("e"), initializer: Generator.LiteralExpression(1)) }), 1704Generator.DelegateDeclaration("d"), 1708Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t")), 1712Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t"), parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("pt")) }), 1716Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1720Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1724Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New), 1728Generator.DelegateDeclaration("d", typeParameters: new[] { "T", "S" }), 1736Generator.NamespaceImportDeclaration(Generator.IdentifierName("n")), 1740Generator.NamespaceImportDeclaration("n"), 1744Generator.NamespaceImportDeclaration("n.m"), 1752Generator.NamespaceDeclaration("n"), 1756Generator.NamespaceDeclaration("n.m"), 1760Generator.NamespaceDeclaration("n", 1761Generator.NamespaceImportDeclaration("m")), 1765Generator.NamespaceDeclaration("n", 1766Generator.ClassDeclaration("c"), 1767Generator.NamespaceImportDeclaration("m")), 1775Generator.CompilationUnit(), 1779Generator.CompilationUnit( 1780Generator.NamespaceDeclaration("n")), 1784Generator.CompilationUnit( 1785Generator.NamespaceImportDeclaration("n")), 1789Generator.CompilationUnit( 1790Generator.ClassDeclaration("c"), 1791Generator.NamespaceImportDeclaration("m")), 1795Generator.CompilationUnit( 1796Generator.NamespaceImportDeclaration("n"), 1797Generator.NamespaceDeclaration("n", 1798Generator.NamespaceImportDeclaration("m"), 1799Generator.ClassDeclaration("c"))), 1807Generator.Attribute(Generator.IdentifierName("a")), 1811Generator.Attribute("a"), 1815Generator.Attribute("a.b"), 1819Generator.Attribute("a", new SyntaxNode[] { }), 1823Generator.Attribute("a", new[] { Generator.IdentifierName("x") }), 1827Generator.Attribute("a", new[] { Generator.AttributeArgument(Generator.IdentifierName("x")) }), 1831Generator.Attribute("a", new[] { Generator.AttributeArgument("x", Generator.IdentifierName("y")) }), 1835Generator.Attribute("a", new[] { Generator.IdentifierName("x"), Generator.IdentifierName("y") }), 1843Generator.AddAttributes( 1844Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1845Generator.Attribute("a")), 1849Generator.AddAttributes( 1850Generator.AddAttributes( 1851Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1852Generator.Attribute("a")), 1853Generator.Attribute("b")), 1857Generator.AddAttributes( 1858Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1859Generator.Attribute("a")), 1863Generator.AddReturnAttributes( 1864Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1865Generator.Attribute("a")), 1869Generator.AddAttributes( 1870Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Abstract), 1871Generator.Attribute("a")), 1875Generator.AddAttributes( 1876Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("z", Generator.IdentifierName("y")) }, Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1877Generator.Attribute("a")), 1881Generator.AddAttributes( 1882Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1883Generator.Attribute("a")), 1887Generator.AddAttributes( 1888Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1889Generator.Attribute("a")), 1893Generator.AddAttributes( 1894Generator.ClassDeclaration("c"), 1895Generator.Attribute("a")), 1899Generator.AddAttributes( 1900Generator.StructDeclaration("s"), 1901Generator.Attribute("a")), 1905Generator.AddAttributes( 1906Generator.InterfaceDeclaration("i"), 1907Generator.Attribute("a")), 1911Generator.AddAttributes( 1912Generator.DelegateDeclaration("d"), 1913Generator.Attribute("a")), 1917Generator.AddAttributes( 1918Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), 1919Generator.Attribute("a")), 1923Generator.AddAttributes( 1924Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 1925Generator.Attribute("a")), 1929Generator.AddAttributes( 1930Generator.AddAttributes( 1931Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 1932Generator.Attribute("a")), 1933Generator.Attribute("b")), 1937Generator.AddAttributes( 1939Generator.Attribute("a")), 1943Generator.AddAttributes( 1945Generator.Attribute("a")), 1949Generator.AddAttributes( 1951Generator.Attribute("a")), 1958var prop = Generator.PropertyDeclaration("P", Generator.IdentifierName("T")); 1959var evnt = Generator.CustomEventDeclaration("E", Generator.IdentifierName("T")); 1960CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.GetAccessor)); 1961CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.SetAccessor)); 1962CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.AddAccessor)); 1963CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.RemoveAccessor)); 1968var initialAttributes = Generator.GetAttributes(declaration); 1971var withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")); 1972var attrsAdded = Generator.GetAttributes(withAttribute); 1975var withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded[0]); 1976var attrsRemoved = Generator.GetAttributes(withoutAttribute); 1986var added = Generator.AddAttributes(cls, Generator.Attribute("a")); 1989var removed = Generator.RemoveAllAttributes(added); 1992var attrWithComment = Generator.GetAttributes(added).First(); 2000Generator.WithTypeParameters( 2001Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2006Generator.WithTypeParameters( 2007Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract)), 2011Generator.WithTypeParameters( 2012Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2017Generator.WithTypeParameters(Generator.WithTypeParameters( 2018Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2023Generator.WithTypeParameters( 2024Generator.ClassDeclaration("c"), 2029Generator.WithTypeParameters( 2030Generator.StructDeclaration("s"), 2035Generator.WithTypeParameters( 2036Generator.InterfaceDeclaration("i"), 2041Generator.WithTypeParameters( 2042Generator.DelegateDeclaration("d"), 2051Generator.WithTypeConstraint( 2052Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2053"a", Generator.IdentifierName("b")), 2057Generator.WithTypeConstraint( 2058Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2059"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2063Generator.WithTypeConstraint( 2064Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2069Generator.WithTypeConstraint(Generator.WithTypeConstraint( 2070Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2071"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), "a"), 2075Generator.WithTypeConstraint( 2076Generator.WithTypeConstraint( 2077Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a", "x"), 2078"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2079"x", Generator.IdentifierName("y")), 2083Generator.WithTypeConstraint( 2084Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2089Generator.WithTypeConstraint( 2090Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2095Generator.WithTypeConstraint( 2096Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2101Generator.WithTypeConstraint( 2102Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2107Generator.WithTypeConstraint( 2108Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2113Generator.WithTypeConstraint( 2114Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2115"a", SpecialTypeConstraintKind.ReferenceType, Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2120Generator.WithTypeConstraint( 2121Generator.WithTypeParameters( 2122Generator.ClassDeclaration("c"), 2124"a", Generator.IdentifierName("x")), 2128Generator.WithTypeConstraint( 2129Generator.WithTypeParameters( 2130Generator.StructDeclaration("s"), 2132"a", Generator.IdentifierName("x")), 2136Generator.WithTypeConstraint( 2137Generator.WithTypeParameters( 2138Generator.InterfaceDeclaration("i"), 2140"a", Generator.IdentifierName("x")), 2144Generator.WithTypeConstraint( 2145Generator.WithTypeParameters( 2146Generator.DelegateDeclaration("d"), 2148"a", Generator.IdentifierName("x")), 2156Generator.Declaration(_emptyCompilation.GetTypeByMetadataName("System.ComponentModel.INotifyPropertyChanged")), 2167Generator.Declaration( 2178Generator.Declaration( 2192Generator.Declaration( 2211VerifySyntax<DelegateDeclarationSyntax>(Generator.Declaration(type), """ 2230Generator.Declaration(method), """ 2251Generator.Declaration(method), """ 2272Generator.Declaration(method), """ 2293Generator.Declaration(method), """ 2314Generator.Declaration(method), 2336Generator.Declaration(property), 2354Generator.Declaration(property), 2377Generator.Declaration(property), 2405Generator.Declaration(property), 2433Generator.Declaration(property), 2464Generator.Declaration(property), 2501Generator.Declaration(method), 2508Generator.Declaration(property), 2511Generator.Declaration(indexer), 2521Generator.Declaration(ev), 2541Generator.Declaration(field), 2561Generator.Declaration(method), """ 2574var actualNames = actualNodes.Select(n => Generator.GetName(n)).ToArray(); 2584=> AssertNamesEqual(expectedNames, Generator.GetMembers(declaration)); 2587=> AssertNamesEqual(new[] { expectedName }, Generator.GetMembers(declaration)); 2592AssertNamesEqual("x.y", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y")))); 2593AssertNamesEqual(new[] { "x.y", "z" }, Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y"), Generator.IdentifierName("z")))); 2594AssertNamesEqual("", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.MethodDeclaration("m")))); 2595AssertNamesEqual(new[] { "x", "y.z" }, Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(Generator.IdentifierName("x")), Generator.DottedName("y.z")))); 2601TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"))); 2602TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y"))); 2604TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x")), "x", new string[] { }); 2605TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "x", new[] { "y" }); 2606TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "y", new[] { "x" }); 2610=> Assert.Equal(0, Generator.GetNamespaceImports(Generator.RemoveNodes(declaration, Generator.GetNamespaceImports(declaration))).Count); 2614var newDecl = Generator.RemoveNode(declaration, Generator.GetNamespaceImports(declaration).First(m => Generator.GetName(m) == name)); 2615AssertNamesEqual(remainingNames, Generator.GetNamespaceImports(newDecl)); 2631var newCu = Generator.RemoveNode(cu, summary); 2657var newCu = Generator.ReplaceNode(cu, summary, summary2); 2680var newCu = Generator.InsertNodesAfter(cu, text, new SyntaxNode[] { text }); 2703var newCu = Generator.InsertNodesBefore(cu, text, new SyntaxNode[] { text }); 2716AssertMemberNamesEqual("m", Generator.AddMembers(Generator.ClassDeclaration("d"), new[] { Generator.MethodDeclaration("m") })); 2717AssertMemberNamesEqual("m", Generator.AddMembers(Generator.StructDeclaration("s"), new[] { Generator.MethodDeclaration("m") })); 2718AssertMemberNamesEqual("m", Generator.AddMembers(Generator.InterfaceDeclaration("i"), new[] { Generator.MethodDeclaration("m") })); 2719AssertMemberNamesEqual("v", Generator.AddMembers(Generator.EnumDeclaration("e"), new[] { Generator.EnumMember("v") })); 2720AssertMemberNamesEqual("n2", Generator.AddMembers(Generator.NamespaceDeclaration("n"), new[] { Generator.NamespaceDeclaration("n2") })); 2721AssertMemberNamesEqual("n", Generator.AddMembers(Generator.CompilationUnit(), new[] { Generator.NamespaceDeclaration("n") })); 2723AssertMemberNamesEqual(new[] { "m", "m2" }, Generator.AddMembers(Generator.ClassDeclaration("d", members: new[] { Generator.MethodDeclaration("m") }), new[] { Generator.MethodDeclaration("m2") })); 2724AssertMemberNamesEqual(new[] { "m", "m2" }, Generator.AddMembers(Generator.StructDeclaration("s", members: new[] { Generator.MethodDeclaration("m") }), new[] { Generator.MethodDeclaration("m2") })); 2725AssertMemberNamesEqual(new[] { "m", "m2" }, Generator.AddMembers(Generator.InterfaceDeclaration("i", members: new[] { Generator.MethodDeclaration("m") }), new[] { Generator.MethodDeclaration("m2") })); 2726AssertMemberNamesEqual(new[] { "v", "v2" }, Generator.AddMembers(Generator.EnumDeclaration("i", members: new[] { Generator.EnumMember("v") }), new[] { Generator.EnumMember("v2") })); 2727AssertMemberNamesEqual(new[] { "n1", "n2" }, Generator.AddMembers(Generator.NamespaceDeclaration("n", new[] { Generator.NamespaceDeclaration("n1") }), new[] { Generator.NamespaceDeclaration("n2") })); 2728AssertMemberNamesEqual(new[] { "n1", "n2" }, Generator.AddMembers(Generator.CompilationUnit(declarations: new[] { Generator.NamespaceDeclaration("n1") }), new[] { Generator.NamespaceDeclaration("n2") })); 2735TestRemoveAllMembers(Generator.ClassDeclaration("c", members: new[] { Generator.MethodDeclaration("m") })); 2736TestRemoveAllMembers(Generator.StructDeclaration("s", members: new[] { Generator.MethodDeclaration("m") })); 2737TestRemoveAllMembers(Generator.InterfaceDeclaration("i", members: new[] { Generator.MethodDeclaration("m") })); 2738TestRemoveAllMembers(Generator.EnumDeclaration("i", members: new[] { Generator.EnumMember("v") })); 2739TestRemoveAllMembers(Generator.NamespaceDeclaration("n", new[] { Generator.NamespaceDeclaration("n") })); 2740TestRemoveAllMembers(Generator.CompilationUnit(declarations: new[] { Generator.NamespaceDeclaration("n") })); 2742TestRemoveMember(Generator.ClassDeclaration("c", members: new[] { Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2") }), "m1", new[] { "m2" }); 2743TestRemoveMember(Generator.StructDeclaration("s", members: new[] { Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2") }), "m1", new[] { "m2" }); 2747=> Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count); 2751var newDecl = Generator.RemoveNode(declaration, Generator.GetMembers(declaration).First(m => Generator.GetName(m) == name)); 2758AssertMemberNamesEqual("m", Generator.ClassDeclaration("c", members: new[] { Generator.MethodDeclaration("m") })); 2759AssertMemberNamesEqual("m", Generator.StructDeclaration("s", members: new[] { Generator.MethodDeclaration("m") })); 2760AssertMemberNamesEqual("m", Generator.InterfaceDeclaration("i", members: new[] { Generator.MethodDeclaration("m") })); 2761AssertMemberNamesEqual("v", Generator.EnumDeclaration("e", members: new[] { Generator.EnumMember("v") })); 2762AssertMemberNamesEqual("c", Generator.NamespaceDeclaration("n", declarations: new[] { Generator.ClassDeclaration("c") })); 2763AssertMemberNamesEqual("c", Generator.CompilationUnit(declarations: new[] { Generator.ClassDeclaration("c") })); 2769Assert.Equal(DeclarationKind.CompilationUnit, Generator.GetDeclarationKind(Generator.CompilationUnit())); 2770Assert.Equal(DeclarationKind.Class, Generator.GetDeclarationKind(Generator.ClassDeclaration("c"))); 2771Assert.Equal(DeclarationKind.Struct, Generator.GetDeclarationKind(Generator.StructDeclaration("s"))); 2772Assert.Equal(DeclarationKind.Interface, Generator.GetDeclarationKind(Generator.InterfaceDeclaration("i"))); 2773Assert.Equal(DeclarationKind.Enum, Generator.GetDeclarationKind(Generator.EnumDeclaration("e"))); 2774Assert.Equal(DeclarationKind.Delegate, Generator.GetDeclarationKind(Generator.DelegateDeclaration("d"))); 2775Assert.Equal(DeclarationKind.Method, Generator.GetDeclarationKind(Generator.MethodDeclaration("m"))); 2776Assert.Equal(DeclarationKind.Constructor, Generator.GetDeclarationKind(Generator.ConstructorDeclaration())); 2777Assert.Equal(DeclarationKind.Parameter, Generator.GetDeclarationKind(Generator.ParameterDeclaration("p"))); 2778Assert.Equal(DeclarationKind.Property, Generator.GetDeclarationKind(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 2779Assert.Equal(DeclarationKind.Indexer, Generator.GetDeclarationKind(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t")))); 2780Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 2781Assert.Equal(DeclarationKind.EnumMember, Generator.GetDeclarationKind(Generator.EnumMember("v"))); 2782Assert.Equal(DeclarationKind.Event, Generator.GetDeclarationKind(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 2783Assert.Equal(DeclarationKind.CustomEvent, Generator.GetDeclarationKind(Generator.CustomEventDeclaration("e", Generator.IdentifierName("t")))); 2784Assert.Equal(DeclarationKind.Namespace, Generator.GetDeclarationKind(Generator.NamespaceDeclaration("n"))); 2785Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))); 2786Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2787Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(Generator.Attribute("a"))); 2793Assert.Equal("c", Generator.GetName(Generator.ClassDeclaration("c"))); 2794Assert.Equal("s", Generator.GetName(Generator.StructDeclaration("s"))); 2795Assert.Equal("i", Generator.GetName(Generator.EnumDeclaration("i"))); 2796Assert.Equal("e", Generator.GetName(Generator.EnumDeclaration("e"))); 2797Assert.Equal("d", Generator.GetName(Generator.DelegateDeclaration("d"))); 2798Assert.Equal("m", Generator.GetName(Generator.MethodDeclaration("m"))); 2799Assert.Equal("", Generator.GetName(Generator.ConstructorDeclaration())); 2800Assert.Equal("p", Generator.GetName(Generator.ParameterDeclaration("p"))); 2801Assert.Equal("p", Generator.GetName(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 2802Assert.Equal("", Generator.GetName(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t")))); 2803Assert.Equal("f", Generator.GetName(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 2804Assert.Equal("v", Generator.GetName(Generator.EnumMember("v"))); 2805Assert.Equal("ef", Generator.GetName(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 2806Assert.Equal("ep", Generator.GetName(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")))); 2807Assert.Equal("n", Generator.GetName(Generator.NamespaceDeclaration("n"))); 2808Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))); 2809Assert.Equal("loc", Generator.GetName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2810Assert.Equal("a", Generator.GetName(Generator.Attribute("a"))); 2816Assert.Equal("c", Generator.GetName(Generator.WithName(Generator.ClassDeclaration("x"), "c"))); 2817Assert.Equal("s", Generator.GetName(Generator.WithName(Generator.StructDeclaration("x"), "s"))); 2818Assert.Equal("i", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "i"))); 2819Assert.Equal("e", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "e"))); 2820Assert.Equal("d", Generator.GetName(Generator.WithName(Generator.DelegateDeclaration("x"), "d"))); 2821Assert.Equal("m", Generator.GetName(Generator.WithName(Generator.MethodDeclaration("x"), "m"))); 2822Assert.Equal("", Generator.GetName(Generator.WithName(Generator.ConstructorDeclaration(), ".ctor"))); 2823Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.ParameterDeclaration("x"), "p"))); 2824Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p"))); 2825Assert.Equal("", Generator.GetName(Generator.WithName(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t")), "this"))); 2826Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f"))); 2827Assert.Equal("v", Generator.GetName(Generator.WithName(Generator.EnumMember("x"), "v"))); 2828Assert.Equal("ef", Generator.GetName(Generator.WithName(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef"))); 2829Assert.Equal("ep", Generator.GetName(Generator.WithName(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep"))); 2830Assert.Equal("n", Generator.GetName(Generator.WithName(Generator.NamespaceDeclaration("x"), "n"))); 2831Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))); 2832Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc"))); 2833Assert.Equal("a", Generator.GetName(Generator.WithName(Generator.Attribute("x"), "a"))); 2839Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal))); 2840Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal))); 2841Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal))); 2842Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal))); 2843Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal))); 2844Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal))); 2845Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal))); 2846Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.ParameterDeclaration("p"))); 2847Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 2848Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 2849Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 2850Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.EnumMember("v"))); 2851Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 2852Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 2853Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceDeclaration("n"))); 2854Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))); 2855Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2856Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.Attribute("a"))); 2857Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(SyntaxFactory.TypeParameter("tp"))); 2863Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal), Accessibility.Private))); 2864Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal), Accessibility.Private))); 2865Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal), Accessibility.Private))); 2866Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal), Accessibility.Private))); 2867Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal), Accessibility.Private))); 2868Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal), Accessibility.Private))); 2869Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal), Accessibility.Private))); 2870Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private))); 2871Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 2872Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 2873Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 2874Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private))); 2875Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 2876Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 2877Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private))); 2878Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))); 2879Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private))); 2880Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private))); 2881Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(SyntaxFactory.TypeParameter("tp"), Accessibility.Private))); 2882Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration), Accessibility.Private))); 2888Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.ClassDeclaration("c", modifiers: DeclarationModifiers.Abstract))); 2889Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.StructDeclaration("s", modifiers: DeclarationModifiers.Partial))); 2890Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.EnumDeclaration("e", modifiers: DeclarationModifiers.New))); 2891Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New))); 2892Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Static))); 2893Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.ConstructorDeclaration(modifiers: DeclarationModifiers.Static))); 2894Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.ParameterDeclaration("p"))); 2895Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 2896Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 2897Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Const))); 2898Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 2899Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 2900Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.EnumMember("v"))); 2901Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceDeclaration("n"))); 2902Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))); 2903Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2904Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.Attribute("a"))); 2905Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(SyntaxFactory.TypeParameter("tp"))); 2911Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), DeclarationModifiers.Abstract))); 2912Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), DeclarationModifiers.Partial))); 2913Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), DeclarationModifiers.New))); 2914Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), DeclarationModifiers.New))); 2915Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), DeclarationModifiers.Static))); 2916Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration(), DeclarationModifiers.Static))); 2917Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.ParameterDeclaration("p"), DeclarationModifiers.Abstract))); 2918Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 2919Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 2920Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), DeclarationModifiers.Const))); 2921Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 2922Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 2923Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumMember("v"), DeclarationModifiers.Partial))); 2924Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceDeclaration("n"), DeclarationModifiers.Abstract))); 2925Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract))); 2926Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract))); 2927Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.Attribute("a"), DeclarationModifiers.Abstract))); 2928Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(SyntaxFactory.TypeParameter("tp"), DeclarationModifiers.Abstract))); 2938Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), allModifiers))); 2942Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), allModifiers))); 2946Generator.GetModifiers(Generator.WithModifiers(Generator.InterfaceDeclaration("i"), allModifiers))); 2950Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), allModifiers))); 2954Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), allModifiers))); 2958Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), allModifiers))); 2962Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration("c"), allModifiers))); 2966Generator.GetModifiers(Generator.WithModifiers(SyntaxFactory.DestructorDeclaration("c"), allModifiers))); 2970Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), allModifiers))); 2974Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), allModifiers))); 2978Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("i") }, Generator.IdentifierName("t")), allModifiers))); 2982Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), allModifiers))); 2986Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), allModifiers))); 2990Generator.GetModifiers(Generator.WithModifiers(SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration), allModifiers))); 2996var ctor = Generator.ConstructorDeclaration("C", modifiers: DeclarationModifiers.Static); 3001var publicCtor = Generator.WithAccessibility(ctor, Accessibility.Public); 3010var ctor = Generator.ConstructorDeclaration("C", accessibility: Accessibility.Public); 3015var staticCtor = Generator.WithModifiers(ctor, DeclarationModifiers.Static); 3025var fileAbstractClass = Generator.WithModifiers(fileClass, Generator.GetModifiers(fileClass).WithIsAbstract(true)); 3035var filePublicClass = Generator.WithAccessibility(fileClass, Accessibility.Public); 3045var fileAbstractClass = Generator.WithModifiers(abstractClass, Generator.GetModifiers(abstractClass).WithIsFile(true)); 3055var filePublicClass = Generator.WithModifiers(publicClass, Generator.GetModifiers(publicClass).WithIsFile(true)); 3065var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3073var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsVirtual(true)); 3083var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3090Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))).ToString()); 3091Assert.Null(Generator.GetType(Generator.MethodDeclaration("m"))); 3093Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()); 3094Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3095Assert.Equal("t", Generator.GetType(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("pt")) }, Generator.IdentifierName("t"))).ToString()); 3096Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3098Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()); 3099Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()); 3101Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType: Generator.IdentifierName("t"))).ToString()); 3102Assert.Null(Generator.GetType(Generator.DelegateDeclaration("d"))); 3104Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()); 3106Assert.Null(Generator.GetType(Generator.ClassDeclaration("c"))); 3107Assert.Null(Generator.GetType(Generator.IdentifierName("x"))); 3113Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3114Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3115Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3116Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("pt")) }, Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3117Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3119Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()); 3121Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3122Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3124Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()); 3125Assert.Null(Generator.GetType(Generator.WithType(Generator.ClassDeclaration("c"), Generator.IdentifierName("t")))); 3126Assert.Null(Generator.GetType(Generator.WithType(Generator.IdentifierName("x"), Generator.IdentifierName("t")))); 3132Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count); 3133Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3134Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")) })).Count); 3136Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count); 3137Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3138Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")) })).Count); 3140Assert.Equal(1, Generator.GetParameters(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, Generator.IdentifierName("t"))).Count); 3141Assert.Equal(2, Generator.GetParameters(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")) }, Generator.IdentifierName("t"))).Count); 3143Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3144Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3146Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3147Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3149Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count); 3150Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters: new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3152Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count); 3153Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count); 3159Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3160Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3161Assert.Equal(3, Generator.GetParameters(Generator.AddParameters(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, Generator.IdentifierName("t")), new[] { Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")), Generator.ParameterDeclaration("p3", Generator.IdentifierName("t3")) })).Count); 3163Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), new[] { Generator.LambdaParameter("p") })).Count); 3164Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), new[] { Generator.LambdaParameter("p") })).Count); 3166Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3168Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3169Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3170Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3171Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) })).Count); 3178Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3179Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3180Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString()); 3183Assert.Null(Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", new[] { Generator.IdentifierName("x") }))); 3184Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", new[] { Generator.IdentifierName("x") })).Count); 3185Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3186Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3187Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3188Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3191Assert.Null(Generator.GetExpression(Generator.IdentifierName("e"))); 3194var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3196method = method.WithExpressionBody(SyntaxFactory.ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3198Assert.Equal("x", Generator.GetExpression(method).ToString()); 3203local = local.WithExpressionBody(SyntaxFactory.ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3205Assert.Equal("x", Generator.GetExpression(local).ToString()); 3212Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3213Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3214Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()); 3217Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", new[] { Generator.IdentifierName("x") }), Generator.IdentifierName("y"))).ToString()); 3218Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", new[] { Generator.IdentifierName("x") }), Generator.IdentifierName("y"))).ToString()); 3219Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(new[] { Generator.IdentifierName("x") }), Generator.IdentifierName("y"))).ToString()); 3220Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(new[] { Generator.IdentifierName("x") }), Generator.IdentifierName("y"))).ToString()); 3221Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3222Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3223Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3224Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3227Assert.Null(Generator.GetExpression(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x")))); 3230var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3232method = method.WithExpressionBody(SyntaxFactory.ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3234Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString()); 3239local = local.WithExpressionBody(SyntaxFactory.ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3241Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString()); 3247var prop = Generator.PropertyDeclaration("p", Generator.IdentifierName("T")); 3249Assert.Equal(2, Generator.GetAccessors(prop).Count); 3252var getAccessor = Generator.GetAccessor(prop, DeclarationKind.GetAccessor); 3258Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(getAccessor)); 3261var setAccessor = Generator.GetAccessor(prop, DeclarationKind.SetAccessor); 3263Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(setAccessor)); 3266Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, getAccessor), DeclarationKind.GetAccessor)); 3267Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, setAccessor), DeclarationKind.SetAccessor)); 3270Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.WithAccessibility(getAccessor, Accessibility.Public))); 3271Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(setAccessor, Accessibility.Private))); 3274Assert.Equal(0, Generator.GetStatements(getAccessor).Count); 3275Assert.Equal(0, Generator.GetStatements(setAccessor).Count); 3277var newGetAccessor = Generator.WithStatements(getAccessor, null); 3281var newNewGetAccessor = Generator.WithStatements(newGetAccessor, new SyntaxNode[] { }); 3288var newProp = Generator.ReplaceNode(prop, getAccessor, Generator.WithAccessibility(getAccessor, Accessibility.Public)); 3289Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.GetAccessor))); 3291newProp = Generator.ReplaceNode(prop, setAccessor, Generator.WithAccessibility(setAccessor, Accessibility.Public)); 3292Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.SetAccessor))); 3299Generator.WithAccessorDeclarations(Generator.PropertyDeclaration("p", Generator.IdentifierName("x"))), 3303Generator.WithAccessorDeclarations( 3304Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3305Generator.GetAccessorDeclaration(Accessibility.NotApplicable, new[] { Generator.ReturnStatement() })), 3309Generator.WithAccessorDeclarations( 3310Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3311Generator.GetAccessorDeclaration(Accessibility.Protected, new[] { Generator.ReturnStatement() })), 3315Generator.WithAccessorDeclarations( 3316Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3317Generator.SetAccessorDeclaration(Accessibility.Protected, new[] { Generator.ReturnStatement() })), 3321Generator.WithAccessorDeclarations(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, Generator.IdentifierName("x"))), 3325Generator.WithAccessorDeclarations(Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, Generator.IdentifierName("x")), 3326Generator.GetAccessorDeclaration(Accessibility.Protected, new[] { Generator.ReturnStatement() })), 3330Generator.WithAccessorDeclarations( 3331Generator.IndexerDeclaration(new[] { Generator.ParameterDeclaration("p", Generator.IdentifierName("t")) }, Generator.IdentifierName("x")), 3332Generator.SetAccessorDeclaration(Accessibility.Protected, new[] { Generator.ReturnStatement() })), 3345var x = Generator.GetMembers(root.Members[0])[0]; 3346var y = Generator.GetMembers(root.Members[0])[1]; 3348Assert.Equal(2, Generator.GetAccessors(x).Count); 3349Assert.Equal(0, Generator.GetAccessors(y).Count); 3352var y2 = Generator.AddAccessors(y, new[] { Generator.GetAccessor(x, DeclarationKind.GetAccessor) }); 3354Assert.Equal(0, Generator.GetAccessors(y2).Count); 3366var x = Generator.GetMembers(root.Members[0])[0]; 3367var y = Generator.GetMembers(root.Members[0])[1]; 3369Assert.Equal(2, Generator.GetAccessors(x).Count); 3370Assert.Equal(0, Generator.GetAccessors(y).Count); 3373var y2 = Generator.AddAccessors(y, new[] { Generator.GetAccessor(x, DeclarationKind.GetAccessor) }); 3375Assert.Equal(0, Generator.GetAccessors(y2).Count); 3389var x = Generator.GetMembers(root.Members[0])[0]; 3390var y = Generator.GetMembers(root.Members[0])[1]; 3391var z = Generator.GetMembers(root.Members[0])[2]; 3393Assert.NotNull(Generator.GetExpression(x)); 3394Assert.NotNull(Generator.GetExpression(y)); 3395Assert.Null(Generator.GetExpression(z)); 3396Assert.Equal("100", Generator.GetExpression(x).ToString()); 3397Assert.Equal("300", Generator.GetExpression(y).ToString()); 3399Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString()); 3400Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3401Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString()); 3414var x = Generator.GetMembers(root.Members[0])[0]; 3415var y = Generator.GetMembers(root.Members[0])[1]; 3417Assert.Null(Generator.GetExpression(x)); 3418Assert.NotNull(Generator.GetExpression(y)); 3419Assert.Equal("p * 10", Generator.GetExpression(y).ToString()); 3421Assert.Null(Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500)))); 3422Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3431Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3434Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3437Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count); 3438Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements: stmts)).Count); 3440Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count); 3441Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements: stmts)).Count); 3443Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression(new SyntaxNode[] { })).Count); 3444Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count); 3446Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression(new SyntaxNode[] { })).Count); 3447Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count); 3449Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count); 3458Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3461Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3464Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count); 3465Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count); 3466Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }), stmts)).Count); 3467Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }), stmts)).Count); 3469Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count); 3478Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3481Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3484var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3487Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3488Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3490Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t"))).Count); 3491Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3493Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count); 3496Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3497Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3499Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t"))).Count); 3500Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3502Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count); 3511Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3514Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3517var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3520Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3521Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t")), stmts)).Count); 3522Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3525Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3526Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IndexerDeclaration(new[] { p }, Generator.IdentifierName("t")), stmts)).Count); 3527Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3538var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3549var baseListB = Generator.GetBaseAndInterfaceTypes(classB); 3559var baseListN = Generator.GetBaseAndInterfaceTypes(classN); 3572var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3576Generator.RemoveNode(classBI, baseListBI[0]), 3582Generator.RemoveNode(classBI, baseListBI[1]), 3588Generator.RemoveNodes(classBI, baseListBI), 3613Generator.AddBaseType(classC, Generator.IdentifierName("T")), 3619Generator.AddBaseType(classCI, Generator.IdentifierName("T")), 3626Generator.AddBaseType(classCB, Generator.IdentifierName("T")), 3651Generator.AddInterfaceType(classC, Generator.IdentifierName("T")), 3657Generator.AddInterfaceType(classCI, Generator.IdentifierName("T")), 3663Generator.AddInterfaceType(classCB, Generator.IdentifierName("T")), 3683var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3684var declX = Generator.GetDeclaration(symbolX.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3685var declY = Generator.GetDeclaration(symbolY.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3686var declZ = Generator.GetDeclaration(symbolZ.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3688Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declX)); 3689Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declY)); 3690Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declZ)); 3692Assert.NotNull(Generator.GetType(declX)); 3693Assert.Equal("int", Generator.GetType(declX).ToString()); 3694Assert.Equal("X", Generator.GetName(declX)); 3695Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declX)); 3696Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declX)); 3698Assert.NotNull(Generator.GetType(declY)); 3699Assert.Equal("int", Generator.GetType(declY).ToString()); 3700Assert.Equal("Y", Generator.GetName(declY)); 3701Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declY)); 3702Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declY)); 3704Assert.NotNull(Generator.GetType(declZ)); 3705Assert.Equal("int", Generator.GetType(declZ).ToString()); 3706Assert.Equal("Z", Generator.GetName(declZ)); 3707Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declZ)); 3708Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declZ)); 3710var xTypedT = Generator.WithType(declX, Generator.IdentifierName("T")); 3711Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xTypedT)); 3713Assert.Equal("T", Generator.GetType(xTypedT).ToString()); 3715var xNamedQ = Generator.WithName(declX, "Q"); 3716Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xNamedQ)); 3718Assert.Equal("Q", Generator.GetName(xNamedQ).ToString()); 3720var xInitialized = Generator.WithExpression(declX, Generator.IdentifierName("e")); 3721Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xInitialized)); 3723Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()); 3725var xPrivate = Generator.WithAccessibility(declX, Accessibility.Private); 3726Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xPrivate)); 3728Assert.Equal(Accessibility.Private, Generator.GetAccessibility(xPrivate)); 3730var xReadOnly = Generator.WithModifiers(declX, DeclarationModifiers.ReadOnly); 3731Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xReadOnly)); 3733Assert.Equal(DeclarationModifiers.ReadOnly, Generator.GetModifiers(xReadOnly)); 3735var xAttributed = Generator.AddAttributes(declX, Generator.Attribute("A")); 3736Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xAttributed)); 3738Assert.Equal(1, Generator.GetAttributes(xAttributed).Count); 3739Assert.Equal("[A]", Generator.GetAttributes(xAttributed)[0].ToString()); 3741var membersC = Generator.GetMembers(declC); 3748Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3756Generator.InsertMembers(declC, 1, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3765Generator.InsertMembers(declC, 2, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3774Generator.InsertMembers(declC, 3, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3782Generator.ClassDeclaration("C", members: new[] { declX, declY }), 3790Generator.ReplaceNode(declC, declX, xTypedT), 3798Generator.ReplaceNode(declC, declY, Generator.WithType(declY, Generator.IdentifierName("T"))), 3807Generator.ReplaceNode(declC, declZ, Generator.WithType(declZ, Generator.IdentifierName("T"))), 3815Generator.ReplaceNode(declC, declX, Generator.WithAccessibility(declX, Accessibility.Private)), 3823Generator.ReplaceNode(declC, declX, Generator.WithModifiers(declX, DeclarationModifiers.None)), 3830Generator.ReplaceNode(declC, declX, Generator.WithName(declX, "Q")), 3836Generator.ReplaceNode(declC, declX.GetAncestorOrThis<VariableDeclaratorSyntax>(), SyntaxFactory.VariableDeclarator("Q")), 3843Generator.ReplaceNode(declC, declX, Generator.WithExpression(declX, Generator.IdentifierName("e"))), 3860var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3863Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3878var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3881Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3899var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3902Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3917var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3920Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3935var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3938Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 3953var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3956Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 3971var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3974Generator.InsertMembers(declC, 0, Generator.EnumMember("A")), 3989var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3992Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4007var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4010Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4027var attrs = Generator.GetAttributes(declC); 4034Assert.Equal("X", Generator.GetName(attrX)); 4035Assert.Equal("Y", Generator.GetName(attrY)); 4036Assert.Equal("Z", Generator.GetName(attrZ)); 4038var xNamedQ = Generator.WithName(attrX, "Q"); 4039Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4043var xWithArg = Generator.AddAttributeArguments(attrX, new[] { Generator.AttributeArgument(Generator.IdentifierName("e")) }); 4044Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4050Generator.InsertAttributes(declC, 0, Generator.Attribute("A")), 4058Generator.InsertAttributes(declC, 1, Generator.Attribute("A")), 4067Generator.InsertAttributes(declC, 2, Generator.Attribute("A")), 4076Generator.InsertAttributes(declC, 3, Generator.Attribute("A")), 4085Generator.RemoveNodes(declC, new[] { attrX }), 4092Generator.RemoveNodes(declC, new[] { attrY }), 4099Generator.RemoveNodes(declC, new[] { attrZ }), 4106Generator.RemoveNodes(declC, new[] { attrX, attrY }), 4113Generator.RemoveNodes(declC, new[] { attrX, attrZ }), 4120Generator.RemoveNodes(declC, new[] { attrY, attrZ }), 4127Generator.RemoveNodes(declC, new[] { attrX, attrY, attrZ }), 4134Generator.ReplaceNode(declC, attrX, Generator.Attribute("A")), 4141Generator.ReplaceNode(declC, attrY, Generator.Attribute("A")), 4148Generator.ReplaceNode(declC, attrZ, Generator.Attribute("A")), 4155Generator.ReplaceNode(declC, attrX, Generator.AddAttributeArguments(attrX, new[] { Generator.AttributeArgument(Generator.IdentifierName("e")) })), 4179Generator.MethodDeclaration(method), 4183Generator.IndexerDeclaration(indexer), 4187Generator.PropertyDeclaration(property), 4204var declM = Generator.GetMembers(declC).First(); 4206Assert.Equal(0, Generator.GetAttributes(declM).Count); 4208var attrs = Generator.GetReturnAttributes(declM); 4214Assert.Equal("X", Generator.GetName(attrX)); 4215Assert.Equal("Y", Generator.GetName(attrY)); 4216Assert.Equal("Z", Generator.GetName(attrZ)); 4218var xNamedQ = Generator.WithName(attrX, "Q"); 4219Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4223var xWithArg = Generator.AddAttributeArguments(attrX, new[] { Generator.AttributeArgument(Generator.IdentifierName("e")) }); 4224Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4230Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("A")), 4238Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("A")), 4247Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("A")), 4256Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("A")), 4265Generator.ReplaceNode(declM, attrX, Generator.Attribute("Q")), 4272Generator.ReplaceNode(declM, attrX, Generator.AddAttributeArguments(attrX, new[] { Generator.AttributeArgument(Generator.IdentifierName("e")) })), 4296var declM = Generator.GetMembers(declC).First(); 4298var attrs = Generator.GetAttributes(declM); 4302Assert.Equal("X", Generator.GetName(attrX)); 4306Assert.Equal("Y", Generator.GetName(attrY)); 4310Assert.Equal("Z", Generator.GetName(attrZ)); 4314Assert.Equal("P", Generator.GetName(attrP)); 4317var rattrs = Generator.GetReturnAttributes(declM); 4321Assert.Equal("A", Generator.GetName(attrA)); 4325Assert.Equal("B", Generator.GetName(attrB)); 4329Assert.Equal("C", Generator.GetName(attrC)); 4333Assert.Equal("D", Generator.GetName(attrD)); 4338Generator.InsertAttributes(declM, 0, Generator.Attribute("Q")), 4350Generator.InsertAttributes(declM, 1, Generator.Attribute("Q")), 4362Generator.InsertAttributes(declM, 2, Generator.Attribute("Q")), 4375Generator.InsertAttributes(declM, 3, Generator.Attribute("Q")), 4387Generator.InsertAttributes(declM, 4, Generator.Attribute("Q")), 4399Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("Q")), 4411Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("Q")), 4423Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("Q")), 4436Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("Q")), 4449Generator.InsertReturnAttributes(declM, 4, Generator.Attribute("Q")), 4478var newDecl = Generator.AddInterfaceType(decl, Generator.IdentifierName("IDisposable")); 4494Generator.Declaration(symbolR), 4509Generator.Declaration(symbolR), 4532Generator.Declaration(symbolR), 4547Generator.Declaration(symbolR),