2471 references to Generator
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2471)
CodeGeneration\SyntaxGeneratorTests.cs (2471)
66VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0), "0"); 67VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1), "1"); 68VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1), "-1"); 69VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MinValue), "global::System.Int32.MinValue"); 70VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(int.MaxValue), "global::System.Int32.MaxValue"); 72VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0L), "0L"); 73VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1L), "1L"); 74VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1L), "-1L"); 75VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MinValue), "global::System.Int64.MinValue"); 76VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(long.MaxValue), "global::System.Int64.MaxValue"); 78VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0UL), "0UL"); 79VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1UL), "1UL"); 80VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ulong.MinValue), "0UL"); 81VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ulong.MaxValue), "global::System.UInt64.MaxValue"); 83VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0f), "0F"); 84VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0f), "1F"); 85VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0f), "-1F"); 86VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MinValue), "global::System.Single.MinValue"); 87VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.MaxValue), "global::System.Single.MaxValue"); 88VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.Epsilon), "global::System.Single.Epsilon"); 89VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NaN), "global::System.Single.NaN"); 90VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.NegativeInfinity), "global::System.Single.NegativeInfinity"); 91VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(float.PositiveInfinity), "global::System.Single.PositiveInfinity"); 93VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0), "0D"); 94VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0), "1D"); 95VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.0), "-1D"); 96VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MinValue), "global::System.Double.MinValue"); 97VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.MaxValue), "global::System.Double.MaxValue"); 98VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.Epsilon), "global::System.Double.Epsilon"); 99VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NaN), "global::System.Double.NaN"); 100VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.NegativeInfinity), "global::System.Double.NegativeInfinity"); 101VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(double.PositiveInfinity), "global::System.Double.PositiveInfinity"); 103VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0m), "0M"); 104VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.00m), "0.00M"); 105VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.00m), "1.00M"); 106VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression(-1.00m), "-1.00M"); 107VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1.0000000000m), "1.0000000000M"); 108VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.000000m), "0.000000M"); 109VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0.0000000m), "0.0000000M"); 110VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1000000000m), "1000000000M"); 111VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(123456789.123456789m), "123456789.123456789M"); 112VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-28m), "0.0000000000000000000000000001M"); 113VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(0E-28m), "0.0000000000000000000000000000M"); 114VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(1E-29m), "0.0000000000000000000000000000M"); 115VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(-1E-29m), "0.0000000000000000000000000000M"); 116VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MinValue), "global::System.Decimal.MinValue"); 117VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(decimal.MaxValue), "global::System.Decimal.MaxValue"); 119VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression('c'), "'c'"); 121VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("str"), "\"str\""); 122VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("s\"t\"r"), "\"s\\\"t\\\"r\""); 124VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(true), "true"); 125VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(false), "false"); 131VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)0), "0"); 132VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)1), "1"); 133VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((short)-1), "-1"); 134VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MinValue), "global::System.Int16.MinValue"); 135VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MaxValue), "global::System.Int16.MaxValue"); 141VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)0), "0"); 142VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)1), "1"); 143VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ushort.MinValue), "0"); 144VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ushort.MaxValue), "global::System.UInt16.MaxValue"); 150VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)0), "0"); 151VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)1), "1"); 152VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((sbyte)-1), "-1"); 153VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MinValue), "global::System.SByte.MinValue"); 154VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MaxValue), "global::System.SByte.MaxValue"); 160VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)0), "0"); 161VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)1), "1"); 162VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MinValue), "0"); 163VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MaxValue), "255"); 169VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 175VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 181VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 187VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 193VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 199VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 206VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 212VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 218VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 224var attributes = Generator.GetAttributes(Generator.AddAttributes( 225Generator.NamespaceDeclaration("n"), 226Generator.Attribute("Attr"))); 240VerifySyntax<IdentifierNameSyntax>(Generator.IdentifierName("x"), "x"); 241VerifySyntax<QualifiedNameSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 242VerifySyntax<QualifiedNameSyntax>(Generator.DottedName("x.y"), "x.y"); 244VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 245VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 248VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x<y>"); 251VerifySyntax<QualifiedNameSyntax>(Generator.WithTypeArguments(Generator.DottedName("x.y"), Generator.IdentifierName("z")), "x.y<z>"); 254VerifySyntax<MemberAccessExpressionSyntax>(Generator.WithTypeArguments(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y<z>"); 257var gname = Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")); 259VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(gname, Generator.IdentifierName("z")), "x<z>"); 266VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 267VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 268VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 269VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 270VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 272VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 273VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 274VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 275VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 278VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x")), "x"); 279VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x"), "y"), "x y"); 280VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType), "global::System.Int32"); 281VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType, "y"), "global::System.Int32 y"); 282VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 283VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 284VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, ["x", "y"]), "(global::System.Int32 x, global::System.Int32 y)"); 290VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 291VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 293VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 294VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 296VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 297VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 299VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 300VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 302VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 303VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 305VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 306VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 308VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 309VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 316VerifySyntax<QualifiedNameSyntax>(Generator.TypeExpression(genericType), "global::System.Collections.Generic.IEnumerable<T>"); 319VerifySyntax<ArrayTypeSyntax>(Generator.TypeExpression(arrayType), "global::System.Int32[]"); 325VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.NegateExpression(Generator.IdentifierName("x")), "-(x)"); 326VerifySyntax<BinaryExpressionSyntax>(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) + (y)"); 327VerifySyntax<BinaryExpressionSyntax>(Generator.SubtractExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) - (y)"); 328VerifySyntax<BinaryExpressionSyntax>(Generator.MultiplyExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) * (y)"); 329VerifySyntax<BinaryExpressionSyntax>(Generator.DivideExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) / (y)"); 330VerifySyntax<BinaryExpressionSyntax>(Generator.ModuloExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) % (y)"); 332VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.BitwiseNotExpression(Generator.IdentifierName("x")), "~(x)"); 333VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) & (y)"); 334VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) | (y)"); 336VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LogicalNotExpression(Generator.IdentifierName("x")), "!(x)"); 337VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) && (y)"); 338VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) || (y)"); 344VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 345VerifySyntax<BinaryExpressionSyntax>(Generator.ValueEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 347VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 348VerifySyntax<BinaryExpressionSyntax>(Generator.ValueNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 350VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) < (y)"); 351VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) <= (y)"); 353VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) > (y)"); 354VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) >= (y)"); 360VerifySyntax<BinaryExpressionSyntax>(Generator.CoalesceExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) ?? (y)"); 361VerifySyntax<ConditionalExpressionSyntax>(Generator.ConditionalExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "(x) ? (y) : (z)"); 367VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 368VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), "y"), "x.y"); 369VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y.z"); 370VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x(y).z"); 371VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x[y].z"); 372VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "((x) + (y)).z"); 373VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.NegateExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y")), "(-(x)).y"); 380Generator.ArrayCreationExpression(Generator.IdentifierName("x"), Generator.LiteralExpression(10)), 384Generator.ArrayCreationExpression(Generator.IdentifierName("x"), new SyntaxNode[] { Generator.IdentifierName("y"), Generator.IdentifierName("z") }), 398Generator.ObjectCreationExpression(Generator.IdentifierName("x")), 402Generator.ObjectCreationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 410Generator.ObjectCreationExpression(listOfIntType, Generator.IdentifierName("y")), 418Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 422Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), 426Generator.ElementAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 430Generator.ElementAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 434Generator.ElementAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 438Generator.ElementAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 445VerifySyntax<CastExpressionSyntax>(Generator.CastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 446VerifySyntax<CastExpressionSyntax>(Generator.ConvertExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 452VerifySyntax<BinaryExpressionSyntax>(Generator.IsTypeExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) is y"); 453VerifySyntax<BinaryExpressionSyntax>(Generator.TryCastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) as y"); 454VerifySyntax<TypeOfExpressionSyntax>(Generator.TypeOfExpression(Generator.IdentifierName("x")), "typeof(x)"); 461VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x")), "x()"); 462VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x(y)"); 463VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x(y, z)"); 466VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(Generator.IdentifierName("y"))), "x(y)"); 467VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 468VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 471VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x.y()"); 472VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x[y]()"); 473VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x(y)()"); 474VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "((x) + (y))()"); 479=> VerifySyntax<AssignmentExpressionSyntax>(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x = (y)"); 484VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.IdentifierName("x")), "x;"); 485VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("x"))), "x();"); 491VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y"), "x y;"); 492VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;"); 494VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", isConst: true), "const x y;"); 495VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;"); 497VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement("y", Generator.IdentifierName("z")), "var y = z;"); 504Generator.AddEventHandler(Generator.IdentifierName("@event"), Generator.IdentifierName("handler")), 512Generator.RemoveEventHandler(Generator.IdentifierName("@event"), 513Generator.IdentifierName("handler")), "@event -= (handler)"); 518=> VerifySyntax<AwaitExpressionSyntax>(Generator.AwaitExpression(Generator.IdentifierName("x")), "await x"); 522=> VerifySyntax<InvocationExpressionSyntax>(Generator.NameOfExpression(Generator.IdentifierName("x")), "nameof(x)"); 527VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression( 528[Generator.IdentifierName("x"), Generator.IdentifierName("y")]), "(x, y)"); 530VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression([ 531Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 532Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y"))]), "(goo: x, bar: y)"); 538VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(), "return;"); 539VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(Generator.IdentifierName("x")), "return x;"); 545VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.LiteralExpression(1)), "yield return 1;"); 546VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.IdentifierName("x")), "yield return x;"); 552VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(), "throw;"); 553VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(Generator.IdentifierName("x")), "throw x;"); 560Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }), 564Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }, new SyntaxNode[] { }), 568Generator.IfStatement(Generator.IdentifierName("x"), 569new SyntaxNode[] { Generator.IdentifierName("y") }), 573Generator.IfStatement(Generator.IdentifierName("x"), 574new SyntaxNode[] { Generator.IdentifierName("y") }, 575new SyntaxNode[] { Generator.IdentifierName("z") }), 579Generator.IfStatement(Generator.IdentifierName("x"), 580new SyntaxNode[] { Generator.IdentifierName("y") }, 581Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") })), 585Generator.IfStatement(Generator.IdentifierName("x"), 586new SyntaxNode[] { Generator.IdentifierName("y") }, 587Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") }, Generator.IdentifierName("z"))), 595Generator.SwitchStatement(Generator.IdentifierName("x"), 596Generator.SwitchSection(Generator.IdentifierName("y"), 597[Generator.IdentifierName("z")])), 601Generator.SwitchStatement(Generator.IdentifierName("x"), 602Generator.SwitchSection( 603[Generator.IdentifierName("y"), Generator.IdentifierName("p"), Generator.IdentifierName("q")], 604[Generator.IdentifierName("z")])), 608Generator.SwitchStatement(Generator.IdentifierName("x"), 609Generator.SwitchSection(Generator.IdentifierName("y"), 610[Generator.IdentifierName("z")]), 611Generator.SwitchSection(Generator.IdentifierName("a"), 612[Generator.IdentifierName("b")])), 616Generator.SwitchStatement(Generator.IdentifierName("x"), 617Generator.SwitchSection(Generator.IdentifierName("y"), 618[Generator.IdentifierName("z")]), 619Generator.DefaultSwitchSection( 620[Generator.IdentifierName("b")])), 624Generator.SwitchStatement(Generator.IdentifierName("x"), 625Generator.SwitchSection(Generator.IdentifierName("y"), 626[Generator.ExitSwitchStatement()])), 630Generator.SwitchStatement(Generator.TupleExpression([Generator.IdentifierName("x1"), Generator.IdentifierName("x2")]), 631Generator.SwitchSection(Generator.IdentifierName("y"), 632[Generator.IdentifierName("z")])), 641Generator.UsingStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 645Generator.UsingStatement("x", Generator.IdentifierName("y"), [Generator.IdentifierName("z")]), 649Generator.UsingStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), [Generator.IdentifierName("q")]), 657Generator.LockStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 665Generator.TryCatchStatement( 666[Generator.IdentifierName("x")], 667Generator.CatchClause(Generator.IdentifierName("y"), "z", 668[Generator.IdentifierName("a")])), 672Generator.TryCatchStatement( 673[Generator.IdentifierName("s")], 674Generator.CatchClause(Generator.IdentifierName("x"), "y", 675[Generator.IdentifierName("z")]), 676Generator.CatchClause(Generator.IdentifierName("a"), "b", 677[Generator.IdentifierName("c")])), 681Generator.TryCatchStatement( 682[Generator.IdentifierName("s")], 683[Generator.CatchClause(Generator.IdentifierName("x"), "y", [Generator.IdentifierName("z")])], 684[Generator.IdentifierName("a")]), 688Generator.TryFinallyStatement( 689[Generator.IdentifierName("x")], 690[Generator.IdentifierName("a")]), 698Generator.WhileStatement(Generator.IdentifierName("x"), 699[Generator.IdentifierName("y")]), 703Generator.WhileStatement(Generator.IdentifierName("x"), null), 711Generator.ValueReturningLambdaExpression("x", Generator.IdentifierName("y")), 715Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 719Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 723Generator.VoidReturningLambdaExpression("x", Generator.IdentifierName("y")), 727Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 731Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 735Generator.ValueReturningLambdaExpression("x", [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 739Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.ReturnStatement(Generator.IdentifierName("z"))]), 743Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 747Generator.VoidReturningLambdaExpression("x", [Generator.IdentifierName("y")]), 751Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.IdentifierName("z")]), 755Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, [Generator.IdentifierName("y")]), 759Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 763Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 767Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 771Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 781Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32)), 785Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer: Generator.LiteralExpression(0)), 789Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public), 793Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Static | DeclarationModifiers.ReadOnly), 797Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Required), 805Generator.MethodDeclaration("m"), 809Generator.MethodDeclaration("m", typeParameters: ["x", "y"]), 813Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), 817Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), statements: [Generator.IdentifierName("y")]), 821Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], returnType: Generator.IdentifierName("x")), 825Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"), Generator.IdentifierName("a"))], returnType: Generator.IdentifierName("x")), 829Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public), 833Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 837Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial), 841Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial, statements: [Generator.IdentifierName("y")]), 845Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial | DeclarationModifiers.Async, statements: null), 857var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 858var returnType = Generator.TypeExpression(SpecialType.System_Boolean); 861Generator.OperatorDeclaration(OperatorKind.Addition, parameters, returnType), 865Generator.OperatorDeclaration(OperatorKind.BitwiseAnd, parameters, returnType), 869Generator.OperatorDeclaration(OperatorKind.BitwiseOr, parameters, returnType), 873Generator.OperatorDeclaration(OperatorKind.Decrement, parameters, returnType), 877Generator.OperatorDeclaration(OperatorKind.Division, parameters, returnType), 881Generator.OperatorDeclaration(OperatorKind.Equality, parameters, returnType), 885Generator.OperatorDeclaration(OperatorKind.ExclusiveOr, parameters, returnType), 889Generator.OperatorDeclaration(OperatorKind.False, parameters, returnType), 893Generator.OperatorDeclaration(OperatorKind.GreaterThan, parameters, returnType), 897Generator.OperatorDeclaration(OperatorKind.GreaterThanOrEqual, parameters, returnType), 901Generator.OperatorDeclaration(OperatorKind.Increment, parameters, returnType), 905Generator.OperatorDeclaration(OperatorKind.Inequality, parameters, returnType), 909Generator.OperatorDeclaration(OperatorKind.LeftShift, parameters, returnType), 913Generator.OperatorDeclaration(OperatorKind.LessThan, parameters, returnType), 917Generator.OperatorDeclaration(OperatorKind.LessThanOrEqual, parameters, returnType), 921Generator.OperatorDeclaration(OperatorKind.LogicalNot, parameters, returnType), 925Generator.OperatorDeclaration(OperatorKind.Modulus, parameters, returnType), 929Generator.OperatorDeclaration(OperatorKind.Multiply, parameters, returnType), 933Generator.OperatorDeclaration(OperatorKind.OnesComplement, parameters, returnType), 937Generator.OperatorDeclaration(OperatorKind.RightShift, parameters, returnType), 941Generator.OperatorDeclaration(OperatorKind.UnsignedRightShift, parameters, returnType), 945Generator.OperatorDeclaration(OperatorKind.Subtraction, parameters, returnType), 949Generator.OperatorDeclaration(OperatorKind.True, parameters, returnType), 953Generator.OperatorDeclaration(OperatorKind.UnaryNegation, parameters, returnType), 957Generator.OperatorDeclaration(OperatorKind.UnaryPlus, parameters, returnType), 963Generator.OperatorDeclaration(OperatorKind.ImplicitConversion, parameters, returnType), 967Generator.OperatorDeclaration(OperatorKind.ExplicitConversion, parameters, returnType), 974var returnType = Generator.TypeExpression(SpecialType.System_Void); 977Generator.OperatorDeclaration(OperatorKind.Increment, [], returnType), 981Generator.OperatorDeclaration(OperatorKind.Decrement, [], returnType), 988var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 991Generator.OperatorDeclaration(OperatorKind.AdditionAssignment, parameters, returnType), 995Generator.OperatorDeclaration(OperatorKind.SubtractionAssignment, parameters, returnType), 999Generator.OperatorDeclaration(OperatorKind.MultiplicationAssignment, parameters, returnType), 1003Generator.OperatorDeclaration(OperatorKind.DivisionAssignment, parameters, returnType), 1007Generator.OperatorDeclaration(OperatorKind.ModulusAssignment, parameters, returnType), 1011Generator.OperatorDeclaration(OperatorKind.ExclusiveOrAssignment, parameters, returnType), 1015Generator.OperatorDeclaration(OperatorKind.BitwiseAndAssignment, parameters, returnType), 1019Generator.OperatorDeclaration(OperatorKind.BitwiseOrAssignment, parameters, returnType), 1023Generator.OperatorDeclaration(OperatorKind.LeftShiftAssignment, parameters, returnType), 1027Generator.OperatorDeclaration(OperatorKind.RightShiftAssignment, parameters, returnType), 1031Generator.OperatorDeclaration(OperatorKind.UnsignedRightShiftAssignment, parameters, returnType), 1046VerifySyntax<OperatorDeclarationSyntax>(Generator.OperatorDeclaration(operatorSymbol), "public static global::C operator checked ++(global::C x)\r\n{\r\n}"); 1057Generator.Declaration(conversion), 1064Generator.Declaration(conversion), 1082Generator.OperatorDeclaration(op), 1090Generator.ConstructorDeclaration(), 1094Generator.ConstructorDeclaration("c"), 1098Generator.ConstructorDeclaration("c", accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static), 1102Generator.ConstructorDeclaration("c", [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))]), 1106Generator.ConstructorDeclaration("c", 1107parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], 1108baseConstructorArguments: [Generator.IdentifierName("p")]), 1116Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1120Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1124Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1128Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: []), 1132Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1136Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: []), 1140Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1144Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Required), 1148Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: [Generator.IdentifierName("y")]), 1152Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: [Generator.IdentifierName("y")]), 1156Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), setAccessorStatements: [Generator.IdentifierName("y")]), 1160Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), getAccessorStatements: [], setAccessorStatements: [Generator.IdentifierName("y")]), 1168Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1172Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1176Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1180Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1184Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1188Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, 1189getAccessorStatements: [Generator.IdentifierName("a")]), 1193Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, 1194setAccessorStatements: [Generator.IdentifierName("a")]), 1198Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x")), 1202Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1203setAccessorStatements: [Generator.IdentifierName("a")]), 1207Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1208getAccessorStatements: [Generator.IdentifierName("a")], setAccessorStatements: [Generator.IdentifierName("b")]), 1216Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1220Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public), 1224Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static), 1232Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1236Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 1240Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), 1244Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), addAccessorStatements: [Generator.IdentifierName("s")], removeAccessorStatements: [Generator.IdentifierName("s2")]), 1252Generator.AsPublicInterfaceImplementation( 1253Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1254Generator.IdentifierName("i")), 1258Generator.AsPublicInterfaceImplementation( 1259Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1260Generator.IdentifierName("i")), 1264Generator.AsPublicInterfaceImplementation( 1265Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1266Generator.IdentifierName("i")), 1270var pim = Generator.AsPrivateInterfaceImplementation( 1271Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1272Generator.IdentifierName("i")); 1275Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1279Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1284Generator.AsPublicInterfaceImplementation( 1315Generator.IdentifierName("i")), 1319Generator.AsPublicInterfaceImplementation( 1354Generator.IdentifierName("i")), 1358Generator.AsPublicInterfaceImplementation( 1415Generator.IdentifierName("i")), 1419Generator.AsPublicInterfaceImplementation( 1435Generator.IdentifierName("i")), 1439Generator.AsPublicInterfaceImplementation( 1459Generator.IdentifierName("i")), 1463Generator.AsPublicInterfaceImplementation( 1485Generator.IdentifierName("i")), 1489Generator.AsPublicInterfaceImplementation( 1516Generator.IdentifierName("i")), 1520Generator.AsPublicInterfaceImplementation( 1546Generator.IdentifierName("i")), 1555Generator.AsPrivateInterfaceImplementation( 1556Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1557Generator.IdentifierName("i")), 1561Generator.AsPrivateInterfaceImplementation( 1562Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1563Generator.IdentifierName("i")), 1567Generator.AsPrivateInterfaceImplementation( 1568Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Protected, modifiers: DeclarationModifiers.Abstract), 1569Generator.IdentifierName("i")), 1573Generator.AsPrivateInterfaceImplementation( 1574Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1575Generator.IdentifierName("i")), 1579var pim = Generator.AsPublicInterfaceImplementation( 1580Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1581Generator.IdentifierName("i")); 1584Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1588Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1603var method = Generator.GetMembers(iface)[0]; 1605var privateMethod = Generator.AsPrivateInterfaceImplementation(method, Generator.IdentifierName("IFace")); 1616Generator.ClassDeclaration("c"), 1620Generator.ClassDeclaration("c", typeParameters: ["x", "y"]), 1624Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x")), 1628Generator.ClassDeclaration("c", interfaceTypes: [Generator.IdentifierName("x")]), 1632Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x"), interfaceTypes: [Generator.IdentifierName("y")]), 1636Generator.ClassDeclaration("c", interfaceTypes: new SyntaxNode[] { }), 1640Generator.ClassDeclaration("c", members: [Generator.FieldDeclaration("y", type: Generator.IdentifierName("x"))]), 1644Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1648Generator.ClassDeclaration("c", members: [Generator.ConstructorDeclaration()]), 1656Generator.StructDeclaration("s"), 1660Generator.StructDeclaration("s", typeParameters: ["x", "y"]), 1664Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x")]), 1668Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1672Generator.StructDeclaration("s", interfaceTypes: new SyntaxNode[] { }), 1676Generator.StructDeclaration("s", members: [Generator.FieldDeclaration("y", Generator.IdentifierName("x"))]), 1680Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1684Generator.StructDeclaration("s", members: [Generator.ConstructorDeclaration("xxx")]), 1692Generator.InterfaceDeclaration("i"), 1696Generator.InterfaceDeclaration("i", typeParameters: ["x", "y"]), 1700Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a")]), 1704Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a"), Generator.IdentifierName("b")]), 1708Generator.InterfaceDeclaration("i", interfaceTypes: new SyntaxNode[] { }), 1712Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1716Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1720Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.ReadOnly)]), 1724Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.Sealed)]), 1728Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.ReadOnly)]), 1732Generator.InterfaceDeclaration("i", members: [Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1736Generator.InterfaceDeclaration("i", members: [Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1740Generator.InterfaceDeclaration("i", members: [Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1754Generator.Declaration(symbol), 1762Generator.EnumDeclaration("e"), 1766Generator.EnumDeclaration("e", members: [Generator.EnumMember("a"), Generator.EnumMember("b"), Generator.EnumMember("c")]), 1770Generator.EnumDeclaration("e", members: [Generator.IdentifierName("a"), Generator.EnumMember("b"), Generator.IdentifierName("c")]), 1774Generator.EnumDeclaration("e", members: [Generator.EnumMember("a", Generator.LiteralExpression(0)), Generator.EnumMember("b"), Generator.EnumMember("c", Generator.LiteralExpression(5))]), 1778Generator.EnumDeclaration("e", members: [Generator.FieldDeclaration("a", Generator.IdentifierName("e"), initializer: Generator.LiteralExpression(1))]), 1786Generator.DelegateDeclaration("d"), 1790Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t")), 1794Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t"), parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))]), 1798Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1802Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1806Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New), 1810Generator.DelegateDeclaration("d", typeParameters: ["T", "S"]), 1818Generator.NamespaceImportDeclaration(Generator.IdentifierName("n")), 1822Generator.NamespaceImportDeclaration("n"), 1826Generator.NamespaceImportDeclaration("n.m"), 1834Generator.NamespaceDeclaration("n"), 1838Generator.NamespaceDeclaration("n.m"), 1842Generator.NamespaceDeclaration("n", 1843Generator.NamespaceImportDeclaration("m")), 1847Generator.NamespaceDeclaration("n", 1848Generator.ClassDeclaration("c"), 1849Generator.NamespaceImportDeclaration("m")), 1857Generator.CompilationUnit(), 1861Generator.CompilationUnit( 1862Generator.NamespaceDeclaration("n")), 1866Generator.CompilationUnit( 1867Generator.NamespaceImportDeclaration("n")), 1871Generator.CompilationUnit( 1872Generator.ClassDeclaration("c"), 1873Generator.NamespaceImportDeclaration("m")), 1877Generator.CompilationUnit( 1878Generator.NamespaceImportDeclaration("n"), 1879Generator.NamespaceDeclaration("n", 1880Generator.NamespaceImportDeclaration("m"), 1881Generator.ClassDeclaration("c"))), 1889Generator.Attribute(Generator.IdentifierName("a")), 1893Generator.Attribute("a"), 1897Generator.Attribute("a.b"), 1901Generator.Attribute("a", []), 1905Generator.Attribute("a", [Generator.IdentifierName("x")]), 1909Generator.Attribute("a", [Generator.AttributeArgument(Generator.IdentifierName("x"))]), 1913Generator.Attribute("a", [Generator.AttributeArgument("x", Generator.IdentifierName("y"))]), 1917Generator.Attribute("a", [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1925Generator.AddAttributes( 1926Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1927Generator.Attribute("a")), 1931Generator.AddAttributes( 1932Generator.AddAttributes( 1933Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1934Generator.Attribute("a")), 1935Generator.Attribute("b")), 1939Generator.AddAttributes( 1940Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1941Generator.Attribute("a")), 1945Generator.AddReturnAttributes( 1946Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1947Generator.Attribute("a")), 1951Generator.AddAttributes( 1952Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Abstract), 1953Generator.Attribute("a")), 1957Generator.AddAttributes( 1958Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1959Generator.Attribute("a")), 1963Generator.AddAttributes( 1964Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1965Generator.Attribute("a")), 1969Generator.AddAttributes( 1970Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1971Generator.Attribute("a")), 1975Generator.AddAttributes( 1976Generator.ClassDeclaration("c"), 1977Generator.Attribute("a")), 1981Generator.AddAttributes( 1982Generator.StructDeclaration("s"), 1983Generator.Attribute("a")), 1987Generator.AddAttributes( 1988Generator.InterfaceDeclaration("i"), 1989Generator.Attribute("a")), 1993Generator.AddAttributes( 1994Generator.DelegateDeclaration("d"), 1995Generator.Attribute("a")), 1999Generator.AddAttributes( 2000Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), 2001Generator.Attribute("a")), 2005Generator.AddAttributes( 2006Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2007Generator.Attribute("a")), 2011Generator.AddAttributes( 2012Generator.AddAttributes( 2013Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2014Generator.Attribute("a")), 2015Generator.Attribute("b")), 2019Generator.AddAttributes( 2021Generator.Attribute("a")), 2025Generator.AddAttributes( 2027Generator.Attribute("a")), 2031Generator.AddAttributes( 2033Generator.Attribute("a")), 2040var prop = Generator.PropertyDeclaration("P", Generator.IdentifierName("T")); 2041var evnt = Generator.CustomEventDeclaration("E", Generator.IdentifierName("T")); 2042CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.GetAccessor)); 2043CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.SetAccessor)); 2044CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.AddAccessor)); 2045CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.RemoveAccessor)); 2050var initialAttributes = Generator.GetAttributes(declaration); 2053var withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")); 2054var attrsAdded = Generator.GetAttributes(withAttribute); 2057var withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded[0]); 2058var attrsRemoved = Generator.GetAttributes(withoutAttribute); 2068var added = Generator.AddAttributes(cls, Generator.Attribute("a")); 2071var removed = Generator.RemoveAllAttributes(added); 2074var attrWithComment = Generator.GetAttributes(added).First(); 2082Generator.WithTypeParameters( 2083Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2088Generator.WithTypeParameters( 2089Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract)), 2093Generator.WithTypeParameters( 2094Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2099Generator.WithTypeParameters(Generator.WithTypeParameters( 2100Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2105Generator.WithTypeParameters( 2106Generator.ClassDeclaration("c"), 2111Generator.WithTypeParameters( 2112Generator.StructDeclaration("s"), 2117Generator.WithTypeParameters( 2118Generator.InterfaceDeclaration("i"), 2123Generator.WithTypeParameters( 2124Generator.DelegateDeclaration("d"), 2133Generator.WithTypeConstraint( 2134Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2135"a", Generator.IdentifierName("b")), 2139Generator.WithTypeConstraint( 2140Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2141"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2145Generator.WithTypeConstraint( 2146Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2151Generator.WithTypeConstraint(Generator.WithTypeConstraint( 2152Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2153"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), "a"), 2157Generator.WithTypeConstraint( 2158Generator.WithTypeConstraint( 2159Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a", "x"), 2160"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2161"x", Generator.IdentifierName("y")), 2165Generator.WithTypeConstraint( 2166Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2171Generator.WithTypeConstraint( 2172Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2177Generator.WithTypeConstraint( 2178Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2183Generator.WithTypeConstraint( 2184Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2189Generator.WithTypeConstraint( 2190Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2195Generator.WithTypeConstraint( 2196Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2197"a", SpecialTypeConstraintKind.ReferenceType, Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2202Generator.WithTypeConstraint( 2203Generator.WithTypeParameters( 2204Generator.ClassDeclaration("c"), 2206"a", Generator.IdentifierName("x")), 2210Generator.WithTypeConstraint( 2211Generator.WithTypeParameters( 2212Generator.StructDeclaration("s"), 2214"a", Generator.IdentifierName("x")), 2218Generator.WithTypeConstraint( 2219Generator.WithTypeParameters( 2220Generator.InterfaceDeclaration("i"), 2222"a", Generator.IdentifierName("x")), 2226Generator.WithTypeConstraint( 2227Generator.WithTypeParameters( 2228Generator.DelegateDeclaration("d"), 2230"a", Generator.IdentifierName("x")), 2238Generator.Declaration(_emptyCompilation.GetTypeByMetadataName("System.ComponentModel.INotifyPropertyChanged")), 2249Generator.Declaration( 2260Generator.Declaration( 2274Generator.Declaration( 2293VerifySyntax<DelegateDeclarationSyntax>(Generator.Declaration(type), """ 2312Generator.Declaration(method), """ 2333Generator.Declaration(method), """ 2354Generator.Declaration(method), """ 2375Generator.Declaration(method), """ 2396Generator.Declaration(method), 2418Generator.Declaration(property), 2436Generator.Declaration(property), 2459Generator.Declaration(property), 2487Generator.Declaration(property), 2515Generator.Declaration(property), 2546Generator.Declaration(property), 2583Generator.Declaration(method), 2590Generator.Declaration(property), 2593Generator.Declaration(indexer), 2603Generator.Declaration(ev), 2623Generator.Declaration(field), 2646Generator.Declaration(field), 2656Generator.Declaration(field), 2676Generator.Declaration(method), """ 2689var actualNames = actualNodes.Select(n => Generator.GetName(n)).ToArray(); 2699=> AssertNamesEqual(expectedNames, Generator.GetMembers(declaration)); 2707AssertNamesEqual("x.y", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y")))); 2708AssertNamesEqual(["x.y", "z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y"), Generator.IdentifierName("z")))); 2709AssertNamesEqual("", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.MethodDeclaration("m")))); 2710AssertNamesEqual(["x", "y.z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(Generator.IdentifierName("x")), Generator.DottedName("y.z")))); 2716TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"))); 2717TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y"))); 2719TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x")), "x", []); 2720TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "x", ["y"]); 2721TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "y", ["x"]); 2725=> Assert.Equal(0, Generator.GetNamespaceImports(Generator.RemoveNodes(declaration, Generator.GetNamespaceImports(declaration))).Count); 2729var newDecl = Generator.RemoveNode(declaration, Generator.GetNamespaceImports(declaration).First(m => Generator.GetName(m) == name)); 2730AssertNamesEqual(remainingNames, Generator.GetNamespaceImports(newDecl)); 2746var newCu = Generator.RemoveNode(cu, summary); 2772var newCu = Generator.ReplaceNode(cu, summary, summary2); 2795var newCu = Generator.InsertNodesAfter(cu, text, [text]); 2818var newCu = Generator.InsertNodesBefore(cu, text, [text]); 2831AssertMemberNamesEqual("m", Generator.AddMembers(Generator.ClassDeclaration("d"), [Generator.MethodDeclaration("m")])); 2832AssertMemberNamesEqual("m", Generator.AddMembers(Generator.StructDeclaration("s"), [Generator.MethodDeclaration("m")])); 2833AssertMemberNamesEqual("m", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.MethodDeclaration("m")])); 2834AssertMemberNamesEqual("", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.OperatorDeclaration(OperatorKind.Addition)])); 2835AssertMemberNamesEqual("v", Generator.AddMembers(Generator.EnumDeclaration("e"), [Generator.EnumMember("v")])); 2836AssertMemberNamesEqual("n2", Generator.AddMembers(Generator.NamespaceDeclaration("n"), [Generator.NamespaceDeclaration("n2")])); 2837AssertMemberNamesEqual("n", Generator.AddMembers(Generator.CompilationUnit(), [Generator.NamespaceDeclaration("n")])); 2839AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.ClassDeclaration("d", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2840AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2841AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2842AssertMemberNamesEqual(["v", "v2"], Generator.AddMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")]), [Generator.EnumMember("v2")])); 2843AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2844AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2850VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2851[Generator.OperatorDeclaration(OperatorKind.Addition)]), 2859VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2860[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Abstract)]), 2868VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2869[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Virtual)]), 2881var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("m"); 2883method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2885VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2894var getAccessor = (AccessorDeclarationSyntax)Generator.GetAccessorDeclaration(); 2896getAccessor = getAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2898var setAccessor = (AccessorDeclarationSyntax)Generator.SetAccessorDeclaration(); 2900setAccessor = setAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.InvocationExpression(Generator.IdentifierName("x")))); 2903Generator.WithAccessorDeclarations( 2904Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 2907VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2921TestRemoveAllMembers(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2922TestRemoveAllMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2923TestRemoveAllMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 2924TestRemoveAllMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")])); 2925TestRemoveAllMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n")])); 2926TestRemoveAllMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n")])); 2928TestRemoveMember(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2929TestRemoveMember(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2933=> Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count); 2937var newDecl = Generator.RemoveNode(declaration, Generator.GetMembers(declaration).First(m => Generator.GetName(m) == name)); 2944AssertMemberNamesEqual("m", Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2945AssertMemberNamesEqual("m", Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2946AssertMemberNamesEqual("m", Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 2947AssertMemberNamesEqual("v", Generator.EnumDeclaration("e", members: [Generator.EnumMember("v")])); 2948AssertMemberNamesEqual("c", Generator.NamespaceDeclaration("n", declarations: [Generator.ClassDeclaration("c")])); 2949AssertMemberNamesEqual("c", Generator.CompilationUnit(declarations: [Generator.ClassDeclaration("c")])); 2955Assert.Equal(DeclarationKind.CompilationUnit, Generator.GetDeclarationKind(Generator.CompilationUnit())); 2956Assert.Equal(DeclarationKind.Class, Generator.GetDeclarationKind(Generator.ClassDeclaration("c"))); 2957Assert.Equal(DeclarationKind.Struct, Generator.GetDeclarationKind(Generator.StructDeclaration("s"))); 2958Assert.Equal(DeclarationKind.Interface, Generator.GetDeclarationKind(Generator.InterfaceDeclaration("i"))); 2959Assert.Equal(DeclarationKind.Enum, Generator.GetDeclarationKind(Generator.EnumDeclaration("e"))); 2960Assert.Equal(DeclarationKind.Delegate, Generator.GetDeclarationKind(Generator.DelegateDeclaration("d"))); 2961Assert.Equal(DeclarationKind.Method, Generator.GetDeclarationKind(Generator.MethodDeclaration("m"))); 2962Assert.Equal(DeclarationKind.Constructor, Generator.GetDeclarationKind(Generator.ConstructorDeclaration())); 2963Assert.Equal(DeclarationKind.Parameter, Generator.GetDeclarationKind(Generator.ParameterDeclaration("p"))); 2964Assert.Equal(DeclarationKind.Property, Generator.GetDeclarationKind(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 2965Assert.Equal(DeclarationKind.Indexer, Generator.GetDeclarationKind(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 2966Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 2967Assert.Equal(DeclarationKind.EnumMember, Generator.GetDeclarationKind(Generator.EnumMember("v"))); 2968Assert.Equal(DeclarationKind.Event, Generator.GetDeclarationKind(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 2969Assert.Equal(DeclarationKind.CustomEvent, Generator.GetDeclarationKind(Generator.CustomEventDeclaration("e", Generator.IdentifierName("t")))); 2970Assert.Equal(DeclarationKind.Namespace, Generator.GetDeclarationKind(Generator.NamespaceDeclaration("n"))); 2971Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))); 2972Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2973Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(Generator.Attribute("a"))); 2979Assert.Equal("c", Generator.GetName(Generator.ClassDeclaration("c"))); 2980Assert.Equal("s", Generator.GetName(Generator.StructDeclaration("s"))); 2981Assert.Equal("i", Generator.GetName(Generator.EnumDeclaration("i"))); 2982Assert.Equal("e", Generator.GetName(Generator.EnumDeclaration("e"))); 2983Assert.Equal("d", Generator.GetName(Generator.DelegateDeclaration("d"))); 2984Assert.Equal("m", Generator.GetName(Generator.MethodDeclaration("m"))); 2985Assert.Equal("", Generator.GetName(Generator.ConstructorDeclaration())); 2986Assert.Equal("p", Generator.GetName(Generator.ParameterDeclaration("p"))); 2987Assert.Equal("p", Generator.GetName(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 2988Assert.Equal("", Generator.GetName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 2989Assert.Equal("f", Generator.GetName(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 2990Assert.Equal("v", Generator.GetName(Generator.EnumMember("v"))); 2991Assert.Equal("ef", Generator.GetName(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 2992Assert.Equal("ep", Generator.GetName(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")))); 2993Assert.Equal("n", Generator.GetName(Generator.NamespaceDeclaration("n"))); 2994Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))); 2995Assert.Equal("loc", Generator.GetName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 2996Assert.Equal("a", Generator.GetName(Generator.Attribute("a"))); 3002Assert.Equal("c", Generator.GetName(Generator.WithName(Generator.ClassDeclaration("x"), "c"))); 3003Assert.Equal("s", Generator.GetName(Generator.WithName(Generator.StructDeclaration("x"), "s"))); 3004Assert.Equal("i", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "i"))); 3005Assert.Equal("e", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "e"))); 3006Assert.Equal("d", Generator.GetName(Generator.WithName(Generator.DelegateDeclaration("x"), "d"))); 3007Assert.Equal("m", Generator.GetName(Generator.WithName(Generator.MethodDeclaration("x"), "m"))); 3008Assert.Equal("", Generator.GetName(Generator.WithName(Generator.ConstructorDeclaration(), ".ctor"))); 3009Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.ParameterDeclaration("x"), "p"))); 3010Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p"))); 3011Assert.Equal("", Generator.GetName(Generator.WithName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), "this"))); 3012Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f"))); 3013Assert.Equal("v", Generator.GetName(Generator.WithName(Generator.EnumMember("x"), "v"))); 3014Assert.Equal("ef", Generator.GetName(Generator.WithName(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef"))); 3015Assert.Equal("ep", Generator.GetName(Generator.WithName(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep"))); 3016Assert.Equal("n", Generator.GetName(Generator.WithName(Generator.NamespaceDeclaration("x"), "n"))); 3017Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))); 3018Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc"))); 3019Assert.Equal("a", Generator.GetName(Generator.WithName(Generator.Attribute("x"), "a"))); 3025Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal))); 3026Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal))); 3027Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal))); 3028Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal))); 3029Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal))); 3030Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal))); 3031Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal))); 3032Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.ParameterDeclaration("p"))); 3033Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3034Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3035Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3036Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.EnumMember("v"))); 3037Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3038Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3039Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceDeclaration("n"))); 3040Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))); 3041Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3042Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.Attribute("a"))); 3043Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(TypeParameter("tp"))); 3049Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal), Accessibility.Private))); 3050Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal), Accessibility.Private))); 3051Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal), Accessibility.Private))); 3052Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal), Accessibility.Private))); 3053Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal), Accessibility.Private))); 3054Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal), Accessibility.Private))); 3055Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal), Accessibility.Private))); 3056Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private))); 3057Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3058Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3059Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3060Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private))); 3061Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3062Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3063Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private))); 3064Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))); 3065Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private))); 3066Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private))); 3067Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(TypeParameter("tp"), Accessibility.Private))); 3068Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(AccessorDeclaration(SyntaxKind.InitAccessorDeclaration), Accessibility.Private))); 3074Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.ClassDeclaration("c", modifiers: DeclarationModifiers.Abstract))); 3075Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.StructDeclaration("s", modifiers: DeclarationModifiers.Partial))); 3076Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.EnumDeclaration("e", modifiers: DeclarationModifiers.New))); 3077Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New))); 3078Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Static))); 3079Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.ConstructorDeclaration(modifiers: DeclarationModifiers.Static))); 3080Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.ParameterDeclaration("p"))); 3081Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3082Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3083Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Const))); 3084Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3085Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3086Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.EnumMember("v"))); 3087Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceDeclaration("n"))); 3088Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))); 3089Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3090Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.Attribute("a"))); 3091Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(TypeParameter("tp"))); 3097Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), DeclarationModifiers.Abstract))); 3098Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), DeclarationModifiers.Partial))); 3099Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), DeclarationModifiers.New))); 3100Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), DeclarationModifiers.New))); 3101Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), DeclarationModifiers.Static))); 3102Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration(), DeclarationModifiers.Static))); 3103Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.ParameterDeclaration("p"), DeclarationModifiers.Abstract))); 3104Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3105Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3106Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), DeclarationModifiers.Const))); 3107Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3108Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3109Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumMember("v"), DeclarationModifiers.Partial))); 3110Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceDeclaration("n"), DeclarationModifiers.Abstract))); 3111Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract))); 3112Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract))); 3113Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.Attribute("a"), DeclarationModifiers.Abstract))); 3114Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(TypeParameter("tp"), DeclarationModifiers.Abstract))); 3124Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), allModifiers))); 3128Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), allModifiers))); 3132Generator.GetModifiers(Generator.WithModifiers(Generator.InterfaceDeclaration("i"), allModifiers))); 3136Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), allModifiers))); 3140Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), allModifiers))); 3144Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), allModifiers))); 3148Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration("c"), allModifiers))); 3152Generator.GetModifiers(Generator.WithModifiers(DestructorDeclaration("c"), allModifiers))); 3156Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), allModifiers))); 3160Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), allModifiers))); 3164Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), allModifiers))); 3168Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), allModifiers))); 3172Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), allModifiers))); 3176Generator.GetModifiers(Generator.WithModifiers(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration), allModifiers))); 3182var ctor = Generator.ConstructorDeclaration("C", modifiers: DeclarationModifiers.Static); 3187var publicCtor = Generator.WithAccessibility(ctor, Accessibility.Public); 3196var ctor = Generator.ConstructorDeclaration("C", accessibility: Accessibility.Public); 3201var staticCtor = Generator.WithModifiers(ctor, DeclarationModifiers.Static); 3211var fileAbstractClass = Generator.WithModifiers(fileClass, Generator.GetModifiers(fileClass).WithIsAbstract(true)); 3221var filePublicClass = Generator.WithAccessibility(fileClass, Accessibility.Public); 3231var fileAbstractClass = Generator.WithModifiers(abstractClass, Generator.GetModifiers(abstractClass).WithIsFile(true)); 3241var filePublicClass = Generator.WithModifiers(publicClass, Generator.GetModifiers(publicClass).WithIsFile(true)); 3251var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3259var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsVirtual(true)); 3269var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3276Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))).ToString()); 3277Assert.Null(Generator.GetType(Generator.MethodDeclaration("m"))); 3279Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()); 3280Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3281Assert.Equal("t", Generator.GetType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("t"))).ToString()); 3282Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3284Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()); 3285Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()); 3287Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType: Generator.IdentifierName("t"))).ToString()); 3288Assert.Null(Generator.GetType(Generator.DelegateDeclaration("d"))); 3290Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()); 3292Assert.Null(Generator.GetType(Generator.ClassDeclaration("c"))); 3293Assert.Null(Generator.GetType(Generator.IdentifierName("x"))); 3299Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3300Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3301Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3302Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3303Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3305Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()); 3307Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3308Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3310Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()); 3311Assert.Null(Generator.GetType(Generator.WithType(Generator.ClassDeclaration("c"), Generator.IdentifierName("t")))); 3312Assert.Null(Generator.GetType(Generator.WithType(Generator.IdentifierName("x"), Generator.IdentifierName("t")))); 3318Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count); 3319Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3320Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3322Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count); 3323Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3324Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3326Assert.Equal(1, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("t"))).Count); 3327Assert.Equal(2, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))], Generator.IdentifierName("t"))).Count); 3329Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3330Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3332Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3333Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3335Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count); 3336Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3338Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count); 3339Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count); 3345Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3346Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3347Assert.Equal(3, Generator.GetParameters(Generator.AddParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("t")), [Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2")), Generator.ParameterDeclaration("p3", Generator.IdentifierName("t3"))])).Count); 3349Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3350Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3352Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3354Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3355Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3356Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3357Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3364Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3365Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3366Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString()); 3369Assert.Null(Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]))); 3370Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")])).Count); 3371Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3372Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3373Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3374Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3377Assert.Null(Generator.GetExpression(Generator.IdentifierName("e"))); 3380var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3382method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3384Assert.Equal("x", Generator.GetExpression(method).ToString()); 3389local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3391Assert.Equal("x", Generator.GetExpression(local).ToString()); 3398Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3399Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3400Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()); 3403Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3404Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3405Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3406Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3407Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3408Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3409Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3410Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3413Assert.Null(Generator.GetExpression(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x")))); 3416var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3418method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3420Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString()); 3425local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3427Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString()); 3433var prop = Generator.PropertyDeclaration("p", Generator.IdentifierName("T")); 3435Assert.Equal(2, Generator.GetAccessors(prop).Count); 3438var getAccessor = Generator.GetAccessor(prop, DeclarationKind.GetAccessor); 3444Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(getAccessor)); 3447var setAccessor = Generator.GetAccessor(prop, DeclarationKind.SetAccessor); 3449Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(setAccessor)); 3452Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, getAccessor), DeclarationKind.GetAccessor)); 3453Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, setAccessor), DeclarationKind.SetAccessor)); 3456Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.WithAccessibility(getAccessor, Accessibility.Public))); 3457Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(setAccessor, Accessibility.Private))); 3460Assert.Equal(0, Generator.GetStatements(getAccessor).Count); 3461Assert.Equal(0, Generator.GetStatements(setAccessor).Count); 3463var newGetAccessor = Generator.WithStatements(getAccessor, null); 3467var newNewGetAccessor = Generator.WithStatements(newGetAccessor, []); 3474var newProp = Generator.ReplaceNode(prop, getAccessor, Generator.WithAccessibility(getAccessor, Accessibility.Public)); 3475Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.GetAccessor))); 3477newProp = Generator.ReplaceNode(prop, setAccessor, Generator.WithAccessibility(setAccessor, Accessibility.Public)); 3478Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.SetAccessor))); 3485Generator.WithAccessorDeclarations(Generator.PropertyDeclaration("p", Generator.IdentifierName("x"))), 3489Generator.WithAccessorDeclarations( 3490Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3491Generator.GetAccessorDeclaration(Accessibility.NotApplicable, [Generator.ReturnStatement()])), 3495Generator.WithAccessorDeclarations( 3496Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3497Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3501Generator.WithAccessorDeclarations( 3502Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3503Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3507Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x"))), 3511Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3512Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3516Generator.WithAccessorDeclarations( 3517Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3518Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3531var x = Generator.GetMembers(root.Members[0])[0]; 3532var y = Generator.GetMembers(root.Members[0])[1]; 3534Assert.Equal(2, Generator.GetAccessors(x).Count); 3535Assert.Equal(0, Generator.GetAccessors(y).Count); 3538var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3540Assert.Equal(0, Generator.GetAccessors(y2).Count); 3552var x = Generator.GetMembers(root.Members[0])[0]; 3553var y = Generator.GetMembers(root.Members[0])[1]; 3555Assert.Equal(2, Generator.GetAccessors(x).Count); 3556Assert.Equal(0, Generator.GetAccessors(y).Count); 3559var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3561Assert.Equal(0, Generator.GetAccessors(y2).Count); 3575var x = Generator.GetMembers(root.Members[0])[0]; 3576var y = Generator.GetMembers(root.Members[0])[1]; 3577var z = Generator.GetMembers(root.Members[0])[2]; 3579Assert.NotNull(Generator.GetExpression(x)); 3580Assert.NotNull(Generator.GetExpression(y)); 3581Assert.Null(Generator.GetExpression(z)); 3582Assert.Equal("100", Generator.GetExpression(x).ToString()); 3583Assert.Equal("300", Generator.GetExpression(y).ToString()); 3585Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString()); 3586Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3587Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString()); 3600var x = Generator.GetMembers(root.Members[0])[0]; 3601var y = Generator.GetMembers(root.Members[0])[1]; 3603Assert.Null(Generator.GetExpression(x)); 3604Assert.NotNull(Generator.GetExpression(y)); 3605Assert.Equal("p * 10", Generator.GetExpression(y).ToString()); 3607Assert.Null(Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500)))); 3608Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3617Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3620Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3623Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count); 3624Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements: stmts)).Count); 3626Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count); 3627Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements: stmts)).Count); 3629Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression([])).Count); 3630Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count); 3632Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression([])).Count); 3633Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count); 3635Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count); 3644Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3647Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3650Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count); 3651Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count); 3652Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression([]), stmts)).Count); 3653Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression([]), stmts)).Count); 3655Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count); 3664Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3667Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3670var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3673Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3674Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3676Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3677Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3679Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count); 3682Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3683Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3685Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3686Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3688Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count); 3697Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3700Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3703var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3706Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3707Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3708Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3711Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3712Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3713Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3724var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3735var baseListB = Generator.GetBaseAndInterfaceTypes(classB); 3745var baseListN = Generator.GetBaseAndInterfaceTypes(classN); 3758var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3762Generator.RemoveNode(classBI, baseListBI[0]), 3768Generator.RemoveNode(classBI, baseListBI[1]), 3774Generator.RemoveNodes(classBI, baseListBI), 3799Generator.AddBaseType(classC, Generator.IdentifierName("T")), 3805Generator.AddBaseType(classCI, Generator.IdentifierName("T")), 3812Generator.AddBaseType(classCB, Generator.IdentifierName("T")), 3837Generator.AddInterfaceType(classC, Generator.IdentifierName("T")), 3843Generator.AddInterfaceType(classCI, Generator.IdentifierName("T")), 3849Generator.AddInterfaceType(classCB, Generator.IdentifierName("T")), 3869var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3870var declX = Generator.GetDeclaration(symbolX.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3871var declY = Generator.GetDeclaration(symbolY.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3872var declZ = Generator.GetDeclaration(symbolZ.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3874Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declX)); 3875Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declY)); 3876Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declZ)); 3878Assert.NotNull(Generator.GetType(declX)); 3879Assert.Equal("int", Generator.GetType(declX).ToString()); 3880Assert.Equal("X", Generator.GetName(declX)); 3881Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declX)); 3882Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declX)); 3884Assert.NotNull(Generator.GetType(declY)); 3885Assert.Equal("int", Generator.GetType(declY).ToString()); 3886Assert.Equal("Y", Generator.GetName(declY)); 3887Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declY)); 3888Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declY)); 3890Assert.NotNull(Generator.GetType(declZ)); 3891Assert.Equal("int", Generator.GetType(declZ).ToString()); 3892Assert.Equal("Z", Generator.GetName(declZ)); 3893Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declZ)); 3894Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declZ)); 3896var xTypedT = Generator.WithType(declX, Generator.IdentifierName("T")); 3897Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xTypedT)); 3899Assert.Equal("T", Generator.GetType(xTypedT).ToString()); 3901var xNamedQ = Generator.WithName(declX, "Q"); 3902Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xNamedQ)); 3904Assert.Equal("Q", Generator.GetName(xNamedQ).ToString()); 3906var xInitialized = Generator.WithExpression(declX, Generator.IdentifierName("e")); 3907Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xInitialized)); 3909Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()); 3911var xPrivate = Generator.WithAccessibility(declX, Accessibility.Private); 3912Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xPrivate)); 3914Assert.Equal(Accessibility.Private, Generator.GetAccessibility(xPrivate)); 3916var xReadOnly = Generator.WithModifiers(declX, DeclarationModifiers.ReadOnly); 3917Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xReadOnly)); 3919Assert.Equal(DeclarationModifiers.ReadOnly, Generator.GetModifiers(xReadOnly)); 3921var xAttributed = Generator.AddAttributes(declX, Generator.Attribute("A")); 3922Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xAttributed)); 3924Assert.Equal(1, Generator.GetAttributes(xAttributed).Count); 3925Assert.Equal("[A]", Generator.GetAttributes(xAttributed)[0].ToString()); 3927var membersC = Generator.GetMembers(declC); 3934Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3942Generator.InsertMembers(declC, 1, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3951Generator.InsertMembers(declC, 2, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3960Generator.InsertMembers(declC, 3, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 3968Generator.ClassDeclaration("C", members: [declX, declY]), 3976Generator.ReplaceNode(declC, declX, xTypedT), 3984Generator.ReplaceNode(declC, declY, Generator.WithType(declY, Generator.IdentifierName("T"))), 3993Generator.ReplaceNode(declC, declZ, Generator.WithType(declZ, Generator.IdentifierName("T"))), 4001Generator.ReplaceNode(declC, declX, Generator.WithAccessibility(declX, Accessibility.Private)), 4009Generator.ReplaceNode(declC, declX, Generator.WithModifiers(declX, DeclarationModifiers.None)), 4016Generator.ReplaceNode(declC, declX, Generator.WithName(declX, "Q")), 4022Generator.ReplaceNode(declC, declX.GetAncestorOrThis<VariableDeclaratorSyntax>(), VariableDeclarator("Q")), 4029Generator.ReplaceNode(declC, declX, Generator.WithExpression(declX, Generator.IdentifierName("e"))), 4046var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4049Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4064var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4067Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4085var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4088Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4103var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4106Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4121var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4124Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4139var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4142Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4157var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4160Generator.InsertMembers(declC, 0, Generator.EnumMember("A")), 4175var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4178Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4193var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4196Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4213var attrs = Generator.GetAttributes(declC); 4220Assert.Equal("X", Generator.GetName(attrX)); 4221Assert.Equal("Y", Generator.GetName(attrY)); 4222Assert.Equal("Z", Generator.GetName(attrZ)); 4224var xNamedQ = Generator.WithName(attrX, "Q"); 4225Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4229var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4230Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4236Generator.InsertAttributes(declC, 0, Generator.Attribute("A")), 4244Generator.InsertAttributes(declC, 1, Generator.Attribute("A")), 4253Generator.InsertAttributes(declC, 2, Generator.Attribute("A")), 4262Generator.InsertAttributes(declC, 3, Generator.Attribute("A")), 4271Generator.RemoveNodes(declC, [attrX]), 4278Generator.RemoveNodes(declC, [attrY]), 4285Generator.RemoveNodes(declC, [attrZ]), 4292Generator.RemoveNodes(declC, [attrX, attrY]), 4299Generator.RemoveNodes(declC, [attrX, attrZ]), 4306Generator.RemoveNodes(declC, [attrY, attrZ]), 4313Generator.RemoveNodes(declC, [attrX, attrY, attrZ]), 4320Generator.ReplaceNode(declC, attrX, Generator.Attribute("A")), 4327Generator.ReplaceNode(declC, attrY, Generator.Attribute("A")), 4334Generator.ReplaceNode(declC, attrZ, Generator.Attribute("A")), 4341Generator.ReplaceNode(declC, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4365Generator.MethodDeclaration(method), 4369Generator.IndexerDeclaration(indexer), 4373Generator.PropertyDeclaration(property), 4390var declM = Generator.GetMembers(declC).First(); 4392Assert.Equal(0, Generator.GetAttributes(declM).Count); 4394var attrs = Generator.GetReturnAttributes(declM); 4400Assert.Equal("X", Generator.GetName(attrX)); 4401Assert.Equal("Y", Generator.GetName(attrY)); 4402Assert.Equal("Z", Generator.GetName(attrZ)); 4404var xNamedQ = Generator.WithName(attrX, "Q"); 4405Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4409var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4410Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4416Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("A")), 4424Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("A")), 4433Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("A")), 4442Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("A")), 4451Generator.ReplaceNode(declM, attrX, Generator.Attribute("Q")), 4458Generator.ReplaceNode(declM, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4482var declM = Generator.GetMembers(declC).First(); 4484var attrs = Generator.GetAttributes(declM); 4488Assert.Equal("X", Generator.GetName(attrX)); 4492Assert.Equal("Y", Generator.GetName(attrY)); 4496Assert.Equal("Z", Generator.GetName(attrZ)); 4500Assert.Equal("P", Generator.GetName(attrP)); 4503var rattrs = Generator.GetReturnAttributes(declM); 4507Assert.Equal("A", Generator.GetName(attrA)); 4511Assert.Equal("B", Generator.GetName(attrB)); 4515Assert.Equal("C", Generator.GetName(attrC)); 4519Assert.Equal("D", Generator.GetName(attrD)); 4524Generator.InsertAttributes(declM, 0, Generator.Attribute("Q")), 4536Generator.InsertAttributes(declM, 1, Generator.Attribute("Q")), 4548Generator.InsertAttributes(declM, 2, Generator.Attribute("Q")), 4561Generator.InsertAttributes(declM, 3, Generator.Attribute("Q")), 4573Generator.InsertAttributes(declM, 4, Generator.Attribute("Q")), 4585Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("Q")), 4597Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("Q")), 4609Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("Q")), 4622Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("Q")), 4635Generator.InsertReturnAttributes(declM, 4, Generator.Attribute("Q")), 4664var newDecl = Generator.AddInterfaceType(decl, Generator.IdentifierName("IDisposable")); 4680Generator.Declaration(symbolR), 4695Generator.Declaration(symbolR), 4718Generator.Declaration(symbolR), 4733Generator.Declaration(symbolR), 4756Generator.Declaration(symbol), 4776Generator.Declaration(symbol), 4794Generator.Declaration(symbol), 4811Generator.Declaration(symbol), 4836Generator.Declaration(symbol), 4994Generator.Declaration(symbol), 5052Generator.Attribute(attribute), 5060Generator.TypeExpression(type),