2478 references to Generator
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2478)
CodeGeneration\SyntaxGeneratorTests.cs (2478)
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"), """ 124VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression("s\"t\"r"), """ 128VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(true), "true"); 129VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(false), "false"); 135VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)0), "0"); 136VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((short)1), "1"); 137VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((short)-1), "-1"); 138VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MinValue), "global::System.Int16.MinValue"); 139VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(short.MaxValue), "global::System.Int16.MaxValue"); 145VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)0), "0"); 146VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((ushort)1), "1"); 147VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(ushort.MinValue), "0"); 148VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(ushort.MaxValue), "global::System.UInt16.MaxValue"); 154VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)0), "0"); 155VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((sbyte)1), "1"); 156VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LiteralExpression((sbyte)-1), "-1"); 157VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MinValue), "global::System.SByte.MinValue"); 158VerifySyntax<MemberAccessExpressionSyntax>(Generator.LiteralExpression(sbyte.MaxValue), "global::System.SByte.MaxValue"); 164VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)0), "0"); 165VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression((byte)1), "1"); 166VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MinValue), "0"); 167VerifySyntax<LiteralExpressionSyntax>(Generator.LiteralExpression(byte.MaxValue), "255"); 173VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 181VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 189VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 197VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 205VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 213VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 222VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 230VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 238VerifySyntax<AttributeListSyntax>(Generator.Attribute(GetAttributeData( 246var attributes = Generator.GetAttributes(Generator.AddAttributes( 247Generator.NamespaceDeclaration("n"), 248Generator.Attribute("Attr"))); 262VerifySyntax<IdentifierNameSyntax>(Generator.IdentifierName("x"), "x"); 263VerifySyntax<QualifiedNameSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 264VerifySyntax<QualifiedNameSyntax>(Generator.DottedName("x.y"), "x.y"); 266VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 267VerifySyntax<GenericNameSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 270VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x<y>"); 273VerifySyntax<QualifiedNameSyntax>(Generator.WithTypeArguments(Generator.DottedName("x.y"), Generator.IdentifierName("z")), "x.y<z>"); 276VerifySyntax<MemberAccessExpressionSyntax>(Generator.WithTypeArguments(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y<z>"); 279var gname = Generator.WithTypeArguments(Generator.IdentifierName("x"), Generator.IdentifierName("y")); 281VerifySyntax<GenericNameSyntax>(Generator.WithTypeArguments(gname, Generator.IdentifierName("z")), "x<z>"); 288VerifySyntax<TypeSyntax>(Generator.IdentifierName("x"), "x"); 289VerifySyntax<TypeSyntax>(Generator.QualifiedName(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 290VerifySyntax<TypeSyntax>(Generator.DottedName("x.y"), "x.y"); 291VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y")), "x<y>"); 292VerifySyntax<TypeSyntax>(Generator.GenericName("x", Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x<y, z>"); 294VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.IdentifierName("x")), "x[]"); 295VerifySyntax<TypeSyntax>(Generator.ArrayTypeExpression(Generator.ArrayTypeExpression(Generator.IdentifierName("x"))), "x[][]"); 296VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.IdentifierName("x")), "x?"); 297VerifySyntax<TypeSyntax>(Generator.NullableTypeExpression(Generator.NullableTypeExpression(Generator.IdentifierName("x"))), "x?"); 300VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x")), "x"); 301VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(Generator.IdentifierName("x"), "y"), "x y"); 302VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType), "global::System.Int32"); 303VerifySyntax<TupleElementSyntax>(Generator.TupleElementExpression(intType, "y"), "global::System.Int32 y"); 304VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(Generator.TupleElementExpression(Generator.IdentifierName("x")), Generator.TupleElementExpression(Generator.IdentifierName("y"))), "(x, y)"); 305VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }), "(global::System.Int32, global::System.Int32)"); 306VerifySyntax<TypeSyntax>(Generator.TupleTypeExpression(new[] { intType, intType }, ["x", "y"]), "(global::System.Int32 x, global::System.Int32 y)"); 312VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Byte), "byte"); 313VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_SByte), "sbyte"); 315VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int16), "short"); 316VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt16), "ushort"); 318VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int32), "int"); 319VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt32), "uint"); 321VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Int64), "long"); 322VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_UInt64), "ulong"); 324VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Single), "float"); 325VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Double), "double"); 327VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Char), "char"); 328VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_String), "string"); 330VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Object), "object"); 331VerifySyntax<TypeSyntax>(Generator.TypeExpression(SpecialType.System_Decimal), "decimal"); 338VerifySyntax<QualifiedNameSyntax>(Generator.TypeExpression(genericType), "global::System.Collections.Generic.IEnumerable<T>"); 341VerifySyntax<ArrayTypeSyntax>(Generator.TypeExpression(arrayType), "global::System.Int32[]"); 347VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.NegateExpression(Generator.IdentifierName("x")), "-(x)"); 348VerifySyntax<BinaryExpressionSyntax>(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) + (y)"); 349VerifySyntax<BinaryExpressionSyntax>(Generator.SubtractExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) - (y)"); 350VerifySyntax<BinaryExpressionSyntax>(Generator.MultiplyExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) * (y)"); 351VerifySyntax<BinaryExpressionSyntax>(Generator.DivideExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) / (y)"); 352VerifySyntax<BinaryExpressionSyntax>(Generator.ModuloExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) % (y)"); 354VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.BitwiseNotExpression(Generator.IdentifierName("x")), "~(x)"); 355VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) & (y)"); 356VerifySyntax<BinaryExpressionSyntax>(Generator.BitwiseOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) | (y)"); 358VerifySyntax<PrefixUnaryExpressionSyntax>(Generator.LogicalNotExpression(Generator.IdentifierName("x")), "!(x)"); 359VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalAndExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) && (y)"); 360VerifySyntax<BinaryExpressionSyntax>(Generator.LogicalOrExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) || (y)"); 366VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 367VerifySyntax<BinaryExpressionSyntax>(Generator.ValueEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) == (y)"); 369VerifySyntax<BinaryExpressionSyntax>(Generator.ReferenceNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 370VerifySyntax<BinaryExpressionSyntax>(Generator.ValueNotEqualsExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) != (y)"); 372VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) < (y)"); 373VerifySyntax<BinaryExpressionSyntax>(Generator.LessThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) <= (y)"); 375VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) > (y)"); 376VerifySyntax<BinaryExpressionSyntax>(Generator.GreaterThanOrEqualExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) >= (y)"); 382VerifySyntax<BinaryExpressionSyntax>(Generator.CoalesceExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) ?? (y)"); 383VerifySyntax<ConditionalExpressionSyntax>(Generator.ConditionalExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "(x) ? (y) : (z)"); 389VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x.y"); 390VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.IdentifierName("x"), "y"), "x.y"); 391VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x.y.z"); 392VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x(y).z"); 393VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "x[y].z"); 394VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), "((x) + (y)).z"); 395VerifySyntax<MemberAccessExpressionSyntax>(Generator.MemberAccessExpression(Generator.NegateExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y")), "(-(x)).y"); 402Generator.ArrayCreationExpression(Generator.IdentifierName("x"), Generator.LiteralExpression(10)), 406Generator.ArrayCreationExpression(Generator.IdentifierName("x"), new SyntaxNode[] { Generator.IdentifierName("y"), Generator.IdentifierName("z") }), 420Generator.ObjectCreationExpression(Generator.IdentifierName("x")), 424Generator.ObjectCreationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 432Generator.ObjectCreationExpression(listOfIntType, Generator.IdentifierName("y")), 440Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), 444Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), 448Generator.ElementAccessExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 452Generator.ElementAccessExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 456Generator.ElementAccessExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 460Generator.ElementAccessExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), Generator.IdentifierName("z")), 467VerifySyntax<CastExpressionSyntax>(Generator.CastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 468VerifySyntax<CastExpressionSyntax>(Generator.ConvertExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x)(y)"); 474VerifySyntax<BinaryExpressionSyntax>(Generator.IsTypeExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) is y"); 475VerifySyntax<BinaryExpressionSyntax>(Generator.TryCastExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "(x) as y"); 476VerifySyntax<TypeOfExpressionSyntax>(Generator.TypeOfExpression(Generator.IdentifierName("x")), "typeof(x)"); 483VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x")), "x()"); 484VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x(y)"); 485VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"), Generator.IdentifierName("z")), "x(y, z)"); 488VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(Generator.IdentifierName("y"))), "x(y)"); 489VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Ref, Generator.IdentifierName("y"))), "x(ref y)"); 490VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.Argument(RefKind.Out, Generator.IdentifierName("y"))), "x(out y)"); 493VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.MemberAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x.y()"); 494VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.ElementAccessExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x[y]()"); 495VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.InvocationExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "x(y)()"); 496VerifySyntax<InvocationExpressionSyntax>(Generator.InvocationExpression(Generator.AddExpression(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), "((x) + (y))()"); 501=> VerifySyntax<AssignmentExpressionSyntax>(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y")), "x = (y)"); 506VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.IdentifierName("x")), "x;"); 507VerifySyntax<ExpressionStatementSyntax>(Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("x"))), "x();"); 513VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y"), "x y;"); 514VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z")), "x y = z;"); 516VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", isConst: true), "const x y;"); 517VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), isConst: true), "const x y = z;"); 519VerifySyntax<LocalDeclarationStatementSyntax>(Generator.LocalDeclarationStatement("y", Generator.IdentifierName("z")), "var y = z;"); 525Generator.AddEventHandler(Generator.IdentifierName("@event"), Generator.IdentifierName("handler")), 531Generator.RemoveEventHandler(Generator.IdentifierName("@event"), 532Generator.IdentifierName("handler")), "@event -= (handler)"); 536=> VerifySyntax<AwaitExpressionSyntax>(Generator.AwaitExpression(Generator.IdentifierName("x")), "await x"); 540=> VerifySyntax<InvocationExpressionSyntax>(Generator.NameOfExpression(Generator.IdentifierName("x")), "nameof(x)"); 545VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression( 546[Generator.IdentifierName("x"), Generator.IdentifierName("y")]), "(x, y)"); 548VerifySyntax<TupleExpressionSyntax>(Generator.TupleExpression([ 549Generator.Argument("goo", RefKind.None, Generator.IdentifierName("x")), 550Generator.Argument("bar", RefKind.None, Generator.IdentifierName("y"))]), "(goo: x, bar: y)"); 556VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(), "return;"); 557VerifySyntax<ReturnStatementSyntax>(Generator.ReturnStatement(Generator.IdentifierName("x")), "return x;"); 563VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.LiteralExpression(1)), "yield return 1;"); 564VerifySyntax<YieldStatementSyntax>(Generator.YieldReturnStatement(Generator.IdentifierName("x")), "yield return x;"); 570VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(), "throw;"); 571VerifySyntax<ThrowStatementSyntax>(Generator.ThrowStatement(Generator.IdentifierName("x")), "throw x;"); 578Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }), 582Generator.IfStatement(Generator.IdentifierName("x"), new SyntaxNode[] { }, new SyntaxNode[] { }), 586Generator.IfStatement(Generator.IdentifierName("x"), 587new SyntaxNode[] { Generator.IdentifierName("y") }), 591Generator.IfStatement(Generator.IdentifierName("x"), 592new SyntaxNode[] { Generator.IdentifierName("y") }, 593new SyntaxNode[] { Generator.IdentifierName("z") }), 597Generator.IfStatement(Generator.IdentifierName("x"), 598new SyntaxNode[] { Generator.IdentifierName("y") }, 599Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") })), 603Generator.IfStatement(Generator.IdentifierName("x"), 604new SyntaxNode[] { Generator.IdentifierName("y") }, 605Generator.IfStatement(Generator.IdentifierName("p"), new SyntaxNode[] { Generator.IdentifierName("q") }, Generator.IdentifierName("z"))), 613Generator.SwitchStatement(Generator.IdentifierName("x"), 614Generator.SwitchSection(Generator.IdentifierName("y"), 615[Generator.IdentifierName("z")])), 619Generator.SwitchStatement(Generator.IdentifierName("x"), 620Generator.SwitchSection( 621[Generator.IdentifierName("y"), Generator.IdentifierName("p"), Generator.IdentifierName("q")], 622[Generator.IdentifierName("z")])), 626Generator.SwitchStatement(Generator.IdentifierName("x"), 627Generator.SwitchSection(Generator.IdentifierName("y"), 628[Generator.IdentifierName("z")]), 629Generator.SwitchSection(Generator.IdentifierName("a"), 630[Generator.IdentifierName("b")])), 634Generator.SwitchStatement(Generator.IdentifierName("x"), 635Generator.SwitchSection(Generator.IdentifierName("y"), 636[Generator.IdentifierName("z")]), 637Generator.DefaultSwitchSection( 638[Generator.IdentifierName("b")])), 642Generator.SwitchStatement(Generator.IdentifierName("x"), 643Generator.SwitchSection(Generator.IdentifierName("y"), 644[Generator.ExitSwitchStatement()])), 648Generator.SwitchStatement(Generator.TupleExpression([Generator.IdentifierName("x1"), Generator.IdentifierName("x2")]), 649Generator.SwitchSection(Generator.IdentifierName("y"), 650[Generator.IdentifierName("z")])), 659Generator.UsingStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 663Generator.UsingStatement("x", Generator.IdentifierName("y"), [Generator.IdentifierName("z")]), 667Generator.UsingStatement(Generator.IdentifierName("x"), "y", Generator.IdentifierName("z"), [Generator.IdentifierName("q")]), 674Generator.LockStatement(Generator.IdentifierName("x"), [Generator.IdentifierName("y")]), 681Generator.TryCatchStatement( 682[Generator.IdentifierName("x")], 683Generator.CatchClause(Generator.IdentifierName("y"), "z", 684[Generator.IdentifierName("a")])), 688Generator.TryCatchStatement( 689[Generator.IdentifierName("s")], 690Generator.CatchClause(Generator.IdentifierName("x"), "y", 691[Generator.IdentifierName("z")]), 692Generator.CatchClause(Generator.IdentifierName("a"), "b", 693[Generator.IdentifierName("c")])), 697Generator.TryCatchStatement( 698[Generator.IdentifierName("s")], 699[Generator.CatchClause(Generator.IdentifierName("x"), "y", [Generator.IdentifierName("z")])], 700[Generator.IdentifierName("a")]), 704Generator.TryFinallyStatement( 705[Generator.IdentifierName("x")], 706[Generator.IdentifierName("a")]), 714Generator.WhileStatement(Generator.IdentifierName("x"), 715[Generator.IdentifierName("y")]), 719Generator.WhileStatement(Generator.IdentifierName("x"), null), 727Generator.ValueReturningLambdaExpression("x", Generator.IdentifierName("y")), 731Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 735Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 739Generator.VoidReturningLambdaExpression("x", Generator.IdentifierName("y")), 743Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, Generator.IdentifierName("z")), 747Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, Generator.IdentifierName("y")), 751Generator.ValueReturningLambdaExpression("x", [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 755Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.ReturnStatement(Generator.IdentifierName("z"))]), 759Generator.ValueReturningLambdaExpression(new SyntaxNode[] { }, [Generator.ReturnStatement(Generator.IdentifierName("y"))]), 763Generator.VoidReturningLambdaExpression("x", [Generator.IdentifierName("y")]), 767Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x"), Generator.LambdaParameter("y") }, [Generator.IdentifierName("z")]), 771Generator.VoidReturningLambdaExpression(new SyntaxNode[] { }, [Generator.IdentifierName("y")]), 775Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 779Generator.ValueReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 783Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")) }, Generator.IdentifierName("z")), 787Generator.VoidReturningLambdaExpression(new[] { Generator.LambdaParameter("x", Generator.IdentifierName("y")), Generator.LambdaParameter("a", Generator.IdentifierName("b")) }, Generator.IdentifierName("z")), 797Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32)), 801Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), initializer: Generator.LiteralExpression(0)), 805Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public), 809Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Static | DeclarationModifiers.ReadOnly), 813Generator.FieldDeclaration("fld", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Required), 821Generator.MethodDeclaration("m"), 825Generator.MethodDeclaration("m", typeParameters: ["x", "y"]), 829Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), 833Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), statements: [Generator.IdentifierName("y")]), 837Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], returnType: Generator.IdentifierName("x")), 841Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("z", Generator.IdentifierName("y"), Generator.IdentifierName("a"))], returnType: Generator.IdentifierName("x")), 845Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public), 849Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 853Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial), 857Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial, statements: [Generator.IdentifierName("y")]), 861Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Partial | DeclarationModifiers.Async, statements: null), 873var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 874var returnType = Generator.TypeExpression(SpecialType.System_Boolean); 877Generator.OperatorDeclaration(OperatorKind.Addition, parameters, returnType), 881Generator.OperatorDeclaration(OperatorKind.BitwiseAnd, parameters, returnType), 885Generator.OperatorDeclaration(OperatorKind.BitwiseOr, parameters, returnType), 889Generator.OperatorDeclaration(OperatorKind.Decrement, parameters, returnType), 893Generator.OperatorDeclaration(OperatorKind.Division, parameters, returnType), 897Generator.OperatorDeclaration(OperatorKind.Equality, parameters, returnType), 901Generator.OperatorDeclaration(OperatorKind.ExclusiveOr, parameters, returnType), 905Generator.OperatorDeclaration(OperatorKind.False, parameters, returnType), 909Generator.OperatorDeclaration(OperatorKind.GreaterThan, parameters, returnType), 913Generator.OperatorDeclaration(OperatorKind.GreaterThanOrEqual, parameters, returnType), 917Generator.OperatorDeclaration(OperatorKind.Increment, parameters, returnType), 921Generator.OperatorDeclaration(OperatorKind.Inequality, parameters, returnType), 925Generator.OperatorDeclaration(OperatorKind.LeftShift, parameters, returnType), 929Generator.OperatorDeclaration(OperatorKind.LessThan, parameters, returnType), 933Generator.OperatorDeclaration(OperatorKind.LessThanOrEqual, parameters, returnType), 937Generator.OperatorDeclaration(OperatorKind.LogicalNot, parameters, returnType), 941Generator.OperatorDeclaration(OperatorKind.Modulus, parameters, returnType), 945Generator.OperatorDeclaration(OperatorKind.Multiply, parameters, returnType), 949Generator.OperatorDeclaration(OperatorKind.OnesComplement, parameters, returnType), 953Generator.OperatorDeclaration(OperatorKind.RightShift, parameters, returnType), 957Generator.OperatorDeclaration(OperatorKind.UnsignedRightShift, parameters, returnType), 961Generator.OperatorDeclaration(OperatorKind.Subtraction, parameters, returnType), 965Generator.OperatorDeclaration(OperatorKind.True, parameters, returnType), 969Generator.OperatorDeclaration(OperatorKind.UnaryNegation, parameters, returnType), 973Generator.OperatorDeclaration(OperatorKind.UnaryPlus, parameters, returnType), 979Generator.OperatorDeclaration(OperatorKind.ImplicitConversion, parameters, returnType), 983Generator.OperatorDeclaration(OperatorKind.ExplicitConversion, parameters, returnType), 990var returnType = Generator.TypeExpression(SpecialType.System_Void); 993Generator.OperatorDeclaration(OperatorKind.Increment, [], returnType), 997Generator.OperatorDeclaration(OperatorKind.Decrement, [], returnType), 1004var parameters = parameterTypes.Select((t, i) => Generator.ParameterDeclaration("p" + i, Generator.TypeExpression(t))).ToList(); 1007Generator.OperatorDeclaration(OperatorKind.AdditionAssignment, parameters, returnType), 1011Generator.OperatorDeclaration(OperatorKind.SubtractionAssignment, parameters, returnType), 1015Generator.OperatorDeclaration(OperatorKind.MultiplicationAssignment, parameters, returnType), 1019Generator.OperatorDeclaration(OperatorKind.DivisionAssignment, parameters, returnType), 1023Generator.OperatorDeclaration(OperatorKind.ModulusAssignment, parameters, returnType), 1027Generator.OperatorDeclaration(OperatorKind.ExclusiveOrAssignment, parameters, returnType), 1031Generator.OperatorDeclaration(OperatorKind.BitwiseAndAssignment, parameters, returnType), 1035Generator.OperatorDeclaration(OperatorKind.BitwiseOrAssignment, parameters, returnType), 1039Generator.OperatorDeclaration(OperatorKind.LeftShiftAssignment, parameters, returnType), 1043Generator.OperatorDeclaration(OperatorKind.RightShiftAssignment, parameters, returnType), 1047Generator.OperatorDeclaration(OperatorKind.UnsignedRightShiftAssignment, parameters, returnType), 1062VerifySyntax<OperatorDeclarationSyntax>(Generator.OperatorDeclaration(operatorSymbol), "public static global::C operator checked ++(global::C x)\r\n{\r\n}"); 1073Generator.Declaration(conversion), 1080Generator.Declaration(conversion), 1098Generator.OperatorDeclaration(op), 1106Generator.ConstructorDeclaration(), 1110Generator.ConstructorDeclaration("c"), 1114Generator.ConstructorDeclaration("c", accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static), 1118Generator.ConstructorDeclaration("c", [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))]), 1122Generator.ConstructorDeclaration("c", 1123parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], 1124baseConstructorArguments: [Generator.IdentifierName("p")]), 1132Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1136Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1140Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1144Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: []), 1148Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1152Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: []), 1156Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1160Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Required), 1164Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, getAccessorStatements: [Generator.IdentifierName("y")]), 1168Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, setAccessorStatements: [Generator.IdentifierName("y")]), 1172Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), setAccessorStatements: [Generator.IdentifierName("y")]), 1176Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), getAccessorStatements: [], setAccessorStatements: [Generator.IdentifierName("y")]), 1184Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.ReadOnly), 1188Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract | DeclarationModifiers.WriteOnly), 1192Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1196Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly), 1200Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly), 1204Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.ReadOnly, 1205getAccessorStatements: [Generator.IdentifierName("a")]), 1209Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.WriteOnly, 1210setAccessorStatements: [Generator.IdentifierName("a")]), 1214Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x")), 1218Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1219setAccessorStatements: [Generator.IdentifierName("a")]), 1223Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), 1224getAccessorStatements: [Generator.IdentifierName("a")], setAccessorStatements: [Generator.IdentifierName("b")]), 1232Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1236Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public), 1240Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static), 1248Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1252Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Abstract), 1256Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), 1260Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), addAccessorStatements: [Generator.IdentifierName("s")], removeAccessorStatements: [Generator.IdentifierName("s2")]), 1268Generator.AsPublicInterfaceImplementation( 1269Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1270Generator.IdentifierName("i")), 1274Generator.AsPublicInterfaceImplementation( 1275Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1276Generator.IdentifierName("i")), 1280Generator.AsPublicInterfaceImplementation( 1281Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1282Generator.IdentifierName("i")), 1286var pim = Generator.AsPrivateInterfaceImplementation( 1287Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1288Generator.IdentifierName("i")); 1291Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1295Generator.AsPublicInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1300Generator.AsPublicInterfaceImplementation( 1331Generator.IdentifierName("i")), 1335Generator.AsPublicInterfaceImplementation( 1370Generator.IdentifierName("i")), 1374Generator.AsPublicInterfaceImplementation( 1431Generator.IdentifierName("i")), 1435Generator.AsPublicInterfaceImplementation( 1451Generator.IdentifierName("i")), 1455Generator.AsPublicInterfaceImplementation( 1475Generator.IdentifierName("i")), 1479Generator.AsPublicInterfaceImplementation( 1501Generator.IdentifierName("i")), 1505Generator.AsPublicInterfaceImplementation( 1532Generator.IdentifierName("i")), 1536Generator.AsPublicInterfaceImplementation( 1562Generator.IdentifierName("i")), 1571Generator.AsPrivateInterfaceImplementation( 1572Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1573Generator.IdentifierName("i")), 1577Generator.AsPrivateInterfaceImplementation( 1578Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal, modifiers: DeclarationModifiers.Abstract), 1579Generator.IdentifierName("i")), 1583Generator.AsPrivateInterfaceImplementation( 1584Generator.IndexerDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("a"))], type: Generator.IdentifierName("t"), accessibility: Accessibility.Protected, modifiers: DeclarationModifiers.Abstract), 1585Generator.IdentifierName("i")), 1589Generator.AsPrivateInterfaceImplementation( 1590Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1591Generator.IdentifierName("i")), 1595var pim = Generator.AsPublicInterfaceImplementation( 1596Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Private, modifiers: DeclarationModifiers.Abstract), 1597Generator.IdentifierName("i")); 1600Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2")), 1604Generator.AsPrivateInterfaceImplementation(pim, Generator.IdentifierName("i2"), "m2"), 1620var method = Generator.GetMembers(iface)[0]; 1622var privateMethod = Generator.AsPrivateInterfaceImplementation(method, Generator.IdentifierName("IFace")); 1633Generator.ClassDeclaration("c"), 1637Generator.ClassDeclaration("c", typeParameters: ["x", "y"]), 1641Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x")), 1645Generator.ClassDeclaration("c", interfaceTypes: [Generator.IdentifierName("x")]), 1649Generator.ClassDeclaration("c", baseType: Generator.IdentifierName("x"), interfaceTypes: [Generator.IdentifierName("y")]), 1653Generator.ClassDeclaration("c", interfaceTypes: new SyntaxNode[] { }), 1657Generator.ClassDeclaration("c", members: [Generator.FieldDeclaration("y", type: Generator.IdentifierName("x"))]), 1661Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1665Generator.ClassDeclaration("c", members: [Generator.ConstructorDeclaration()]), 1673Generator.StructDeclaration("s"), 1677Generator.StructDeclaration("s", typeParameters: ["x", "y"]), 1681Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x")]), 1685Generator.StructDeclaration("s", interfaceTypes: [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1689Generator.StructDeclaration("s", interfaceTypes: new SyntaxNode[] { }), 1693Generator.StructDeclaration("s", members: [Generator.FieldDeclaration("y", Generator.IdentifierName("x"))]), 1697Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))]), 1701Generator.StructDeclaration("s", members: [Generator.ConstructorDeclaration("xxx")]), 1709Generator.InterfaceDeclaration("i"), 1713Generator.InterfaceDeclaration("i", typeParameters: ["x", "y"]), 1717Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a")]), 1721Generator.InterfaceDeclaration("i", interfaceTypes: [Generator.IdentifierName("a"), Generator.IdentifierName("b")]), 1725Generator.InterfaceDeclaration("i", interfaceTypes: new SyntaxNode[] { }), 1729Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1733Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1737Generator.InterfaceDeclaration("i", members: [Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.ReadOnly)]), 1741Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.Sealed)]), 1745Generator.InterfaceDeclaration("i", members: [Generator.IndexerDeclaration([Generator.ParameterDeclaration("y", Generator.IdentifierName("x"))], Generator.IdentifierName("t"), Accessibility.Public, DeclarationModifiers.ReadOnly)]), 1749Generator.InterfaceDeclaration("i", members: [Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1753Generator.InterfaceDeclaration("i", members: [Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Static)]), 1757Generator.InterfaceDeclaration("i", members: [Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Public, modifiers: DeclarationModifiers.Sealed)]), 1771Generator.Declaration(symbol), 1779Generator.EnumDeclaration("e"), 1783Generator.EnumDeclaration("e", members: [Generator.EnumMember("a"), Generator.EnumMember("b"), Generator.EnumMember("c")]), 1787Generator.EnumDeclaration("e", members: [Generator.IdentifierName("a"), Generator.EnumMember("b"), Generator.IdentifierName("c")]), 1791Generator.EnumDeclaration("e", members: [Generator.EnumMember("a", Generator.LiteralExpression(0)), Generator.EnumMember("b"), Generator.EnumMember("c", Generator.LiteralExpression(5))]), 1795Generator.EnumDeclaration("e", members: [Generator.FieldDeclaration("a", Generator.IdentifierName("e"), initializer: Generator.LiteralExpression(1))]), 1803Generator.DelegateDeclaration("d"), 1807Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t")), 1811Generator.DelegateDeclaration("d", returnType: Generator.IdentifierName("t"), parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))]), 1815Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1819Generator.DelegateDeclaration("d", accessibility: Accessibility.Public), 1823Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New), 1827Generator.DelegateDeclaration("d", typeParameters: ["T", "S"]), 1835Generator.NamespaceImportDeclaration(Generator.IdentifierName("n")), 1839Generator.NamespaceImportDeclaration("n"), 1843Generator.NamespaceImportDeclaration("n.m"), 1851Generator.NamespaceDeclaration("n"), 1855Generator.NamespaceDeclaration("n.m"), 1859Generator.NamespaceDeclaration("n", 1860Generator.NamespaceImportDeclaration("m")), 1864Generator.NamespaceDeclaration("n", 1865Generator.ClassDeclaration("c"), 1866Generator.NamespaceImportDeclaration("m")), 1874Generator.CompilationUnit(), 1878Generator.CompilationUnit( 1879Generator.NamespaceDeclaration("n")), 1883Generator.CompilationUnit( 1884Generator.NamespaceImportDeclaration("n")), 1888Generator.CompilationUnit( 1889Generator.ClassDeclaration("c"), 1890Generator.NamespaceImportDeclaration("m")), 1894Generator.CompilationUnit( 1895Generator.NamespaceImportDeclaration("n"), 1896Generator.NamespaceDeclaration("n", 1897Generator.NamespaceImportDeclaration("m"), 1898Generator.ClassDeclaration("c"))), 1906Generator.Attribute(Generator.IdentifierName("a")), 1910Generator.Attribute("a"), 1914Generator.Attribute("a.b"), 1918Generator.Attribute("a", []), 1922Generator.Attribute("a", [Generator.IdentifierName("x")]), 1926Generator.Attribute("a", [Generator.AttributeArgument(Generator.IdentifierName("x"))]), 1930Generator.Attribute("a", [Generator.AttributeArgument("x", Generator.IdentifierName("y"))]), 1934Generator.Attribute("a", [Generator.IdentifierName("x"), Generator.IdentifierName("y")]), 1942Generator.AddAttributes( 1943Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1944Generator.Attribute("a")), 1948Generator.AddAttributes( 1949Generator.AddAttributes( 1950Generator.FieldDeclaration("y", Generator.IdentifierName("x")), 1951Generator.Attribute("a")), 1952Generator.Attribute("b")), 1956Generator.AddAttributes( 1957Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1958Generator.Attribute("a")), 1962Generator.AddReturnAttributes( 1963Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1964Generator.Attribute("a")), 1968Generator.AddAttributes( 1969Generator.PropertyDeclaration("p", Generator.IdentifierName("x"), accessibility: Accessibility.NotApplicable, modifiers: DeclarationModifiers.Abstract), 1970Generator.Attribute("a")), 1974Generator.AddAttributes( 1975Generator.IndexerDeclaration([Generator.ParameterDeclaration("z", Generator.IdentifierName("y"))], Generator.IdentifierName("x"), modifiers: DeclarationModifiers.Abstract), 1976Generator.Attribute("a")), 1980Generator.AddAttributes( 1981Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract), 1982Generator.Attribute("a")), 1986Generator.AddAttributes( 1987Generator.EventDeclaration("ef", Generator.IdentifierName("t")), 1988Generator.Attribute("a")), 1992Generator.AddAttributes( 1993Generator.ClassDeclaration("c"), 1994Generator.Attribute("a")), 1998Generator.AddAttributes( 1999Generator.StructDeclaration("s"), 2000Generator.Attribute("a")), 2004Generator.AddAttributes( 2005Generator.InterfaceDeclaration("i"), 2006Generator.Attribute("a")), 2010Generator.AddAttributes( 2011Generator.DelegateDeclaration("d"), 2012Generator.Attribute("a")), 2016Generator.AddAttributes( 2017Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), 2018Generator.Attribute("a")), 2022Generator.AddAttributes( 2023Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2024Generator.Attribute("a")), 2028Generator.AddAttributes( 2029Generator.AddAttributes( 2030Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), 2031Generator.Attribute("a")), 2032Generator.Attribute("b")), 2036Generator.AddAttributes( 2038Generator.Attribute("a")), 2042Generator.AddAttributes( 2044Generator.Attribute("a")), 2048Generator.AddAttributes( 2050Generator.Attribute("a")), 2057var prop = Generator.PropertyDeclaration("P", Generator.IdentifierName("T")); 2058var evnt = Generator.CustomEventDeclaration("E", Generator.IdentifierName("T")); 2059CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.GetAccessor)); 2060CheckAddRemoveAttribute(Generator.GetAccessor(prop, DeclarationKind.SetAccessor)); 2061CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.AddAccessor)); 2062CheckAddRemoveAttribute(Generator.GetAccessor(evnt, DeclarationKind.RemoveAccessor)); 2067var initialAttributes = Generator.GetAttributes(declaration); 2070var withAttribute = Generator.AddAttributes(declaration, Generator.Attribute("a")); 2071var attrsAdded = Generator.GetAttributes(withAttribute); 2074var withoutAttribute = Generator.RemoveNode(withAttribute, attrsAdded[0]); 2075var attrsRemoved = Generator.GetAttributes(withoutAttribute); 2087var added = Generator.AddAttributes(cls, Generator.Attribute("a")); 2090var removed = Generator.RemoveAllAttributes(added); 2093var attrWithComment = Generator.GetAttributes(added).First(); 2101Generator.WithTypeParameters( 2102Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2107Generator.WithTypeParameters( 2108Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract)), 2112Generator.WithTypeParameters( 2113Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2118Generator.WithTypeParameters(Generator.WithTypeParameters( 2119Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), 2124Generator.WithTypeParameters( 2125Generator.ClassDeclaration("c"), 2130Generator.WithTypeParameters( 2131Generator.StructDeclaration("s"), 2136Generator.WithTypeParameters( 2137Generator.InterfaceDeclaration("i"), 2142Generator.WithTypeParameters( 2143Generator.DelegateDeclaration("d"), 2152Generator.WithTypeConstraint( 2153Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2154"a", Generator.IdentifierName("b")), 2158Generator.WithTypeConstraint( 2159Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2160"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2164Generator.WithTypeConstraint( 2165Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2170Generator.WithTypeConstraint(Generator.WithTypeConstraint( 2171Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2172"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), "a"), 2176Generator.WithTypeConstraint( 2177Generator.WithTypeConstraint( 2178Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a", "x"), 2179"a", Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2180"x", Generator.IdentifierName("y")), 2184Generator.WithTypeConstraint( 2185Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2190Generator.WithTypeConstraint( 2191Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2196Generator.WithTypeConstraint( 2197Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2202Generator.WithTypeConstraint( 2203Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2208Generator.WithTypeConstraint( 2209Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2214Generator.WithTypeConstraint( 2215Generator.WithTypeParameters(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Abstract), "a"), 2216"a", SpecialTypeConstraintKind.ReferenceType, Generator.IdentifierName("b"), Generator.IdentifierName("c")), 2221Generator.WithTypeConstraint( 2222Generator.WithTypeParameters( 2223Generator.ClassDeclaration("c"), 2225"a", Generator.IdentifierName("x")), 2229Generator.WithTypeConstraint( 2230Generator.WithTypeParameters( 2231Generator.StructDeclaration("s"), 2233"a", Generator.IdentifierName("x")), 2237Generator.WithTypeConstraint( 2238Generator.WithTypeParameters( 2239Generator.InterfaceDeclaration("i"), 2241"a", Generator.IdentifierName("x")), 2245Generator.WithTypeConstraint( 2246Generator.WithTypeParameters( 2247Generator.DelegateDeclaration("d"), 2249"a", Generator.IdentifierName("x")), 2256Generator.Declaration(_emptyCompilation.GetTypeByMetadataName("System.ComponentModel.INotifyPropertyChanged")), 2267Generator.Declaration( 2278Generator.Declaration( 2292Generator.Declaration( 2312VerifySyntax<DelegateDeclarationSyntax>(Generator.Declaration(type), """ 2331Generator.Declaration(method), """ 2352Generator.Declaration(method), """ 2373Generator.Declaration(method), """ 2394Generator.Declaration(method), """ 2415Generator.Declaration(method), 2437Generator.Declaration(property), 2455Generator.Declaration(property), 2478Generator.Declaration(property), 2506Generator.Declaration(property), 2534Generator.Declaration(property), 2565Generator.Declaration(property), 2602Generator.Declaration(method), 2609Generator.Declaration(property), 2612Generator.Declaration(indexer), 2622Generator.Declaration(ev), 2642Generator.Declaration(field), 2665Generator.Declaration(field), 2675Generator.Declaration(field), 2695Generator.Declaration(method), """ 2708var actualNames = actualNodes.Select(n => Generator.GetName(n)).ToArray(); 2718=> AssertNamesEqual(expectedNames, Generator.GetMembers(declaration)); 2721=> AssertNamesEqual([expectedName], Generator.GetMembers(declaration)); 2726AssertNamesEqual("x.y", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y")))); 2727AssertNamesEqual(["x.y", "z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y"), Generator.IdentifierName("z")))); 2728AssertNamesEqual("", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.MethodDeclaration("m")))); 2729AssertNamesEqual(["x", "y.z"], Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(Generator.IdentifierName("x")), Generator.DottedName("y.z")))); 2735TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"))); 2736TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y"))); 2738TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x")), "x", []); 2739TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "x", ["y"]); 2740TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "y", ["x"]); 2744=> Assert.Equal(0, Generator.GetNamespaceImports(Generator.RemoveNodes(declaration, Generator.GetNamespaceImports(declaration))).Count); 2748var newDecl = Generator.RemoveNode(declaration, Generator.GetNamespaceImports(declaration).First(m => Generator.GetName(m) == name)); 2749AssertNamesEqual(remainingNames, Generator.GetNamespaceImports(newDecl)); 2766var newCu = Generator.RemoveNode(cu, summary); 2794var newCu = Generator.ReplaceNode(cu, summary, summary2); 2819var newCu = Generator.InsertNodesAfter(cu, text, [text]); 2844var newCu = Generator.InsertNodesBefore(cu, text, [text]); 2858AssertMemberNamesEqual("m", Generator.AddMembers(Generator.ClassDeclaration("d"), [Generator.MethodDeclaration("m")])); 2859AssertMemberNamesEqual("m", Generator.AddMembers(Generator.StructDeclaration("s"), [Generator.MethodDeclaration("m")])); 2860AssertMemberNamesEqual("m", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.MethodDeclaration("m")])); 2861AssertMemberNamesEqual("", Generator.AddMembers(Generator.InterfaceDeclaration("i"), [Generator.OperatorDeclaration(OperatorKind.Addition)])); 2862AssertMemberNamesEqual("v", Generator.AddMembers(Generator.EnumDeclaration("e"), [Generator.EnumMember("v")])); 2863AssertMemberNamesEqual("n2", Generator.AddMembers(Generator.NamespaceDeclaration("n"), [Generator.NamespaceDeclaration("n2")])); 2864AssertMemberNamesEqual("n", Generator.AddMembers(Generator.CompilationUnit(), [Generator.NamespaceDeclaration("n")])); 2866AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.ClassDeclaration("d", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2867AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2868AssertMemberNamesEqual(["m", "m2"], Generator.AddMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")]), [Generator.MethodDeclaration("m2")])); 2869AssertMemberNamesEqual(["v", "v2"], Generator.AddMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")]), [Generator.EnumMember("v2")])); 2870AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2871AssertMemberNamesEqual(["n1", "n2"], Generator.AddMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n1")]), [Generator.NamespaceDeclaration("n2")])); 2877VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2878[Generator.OperatorDeclaration(OperatorKind.Addition)]), 2886VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2887[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Abstract)]), 2895VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2896[Generator.OperatorDeclaration(OperatorKind.Addition, modifiers: DeclarationModifiers.Virtual)]), 2909var node = Generator.AddMembers(Generator.ClassDeclaration("C"), 2911Generator.MethodDeclaration("M1", returnType: Generator.TypeExpression(SpecialType.System_Void), accessibility: Accessibility.Public), 2912Generator.PropertyDeclaration("P1", Generator.TypeExpression(SpecialType.System_Int32), accessibility: Accessibility.Public) 2932var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("m"); 2934method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2936VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2945var getAccessor = (AccessorDeclarationSyntax)Generator.GetAccessorDeclaration(); 2947getAccessor = getAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 2949var setAccessor = (AccessorDeclarationSyntax)Generator.SetAccessorDeclaration(); 2951setAccessor = setAccessor.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.InvocationExpression(Generator.IdentifierName("x")))); 2954Generator.WithAccessorDeclarations( 2955Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 2958VerifySyntax<InterfaceDeclarationSyntax>(Generator.AddMembers(Generator.InterfaceDeclaration("i"), 2972TestRemoveAllMembers(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2973TestRemoveAllMembers(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2974TestRemoveAllMembers(Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 2975TestRemoveAllMembers(Generator.EnumDeclaration("i", members: [Generator.EnumMember("v")])); 2976TestRemoveAllMembers(Generator.NamespaceDeclaration("n", [Generator.NamespaceDeclaration("n")])); 2977TestRemoveAllMembers(Generator.CompilationUnit(declarations: [Generator.NamespaceDeclaration("n")])); 2979TestRemoveMember(Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2980TestRemoveMember(Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m1"), Generator.MethodDeclaration("m2")]), "m1", ["m2"]); 2984=> Assert.Equal(0, Generator.GetMembers(Generator.RemoveNodes(declaration, Generator.GetMembers(declaration))).Count); 2988var newDecl = Generator.RemoveNode(declaration, Generator.GetMembers(declaration).First(m => Generator.GetName(m) == name)); 2995AssertMemberNamesEqual("m", Generator.ClassDeclaration("c", members: [Generator.MethodDeclaration("m")])); 2996AssertMemberNamesEqual("m", Generator.StructDeclaration("s", members: [Generator.MethodDeclaration("m")])); 2997AssertMemberNamesEqual("m", Generator.InterfaceDeclaration("i", members: [Generator.MethodDeclaration("m")])); 2998AssertMemberNamesEqual("v", Generator.EnumDeclaration("e", members: [Generator.EnumMember("v")])); 2999AssertMemberNamesEqual("c", Generator.NamespaceDeclaration("n", declarations: [Generator.ClassDeclaration("c")])); 3000AssertMemberNamesEqual("c", Generator.CompilationUnit(declarations: [Generator.ClassDeclaration("c")])); 3006Assert.Equal(DeclarationKind.CompilationUnit, Generator.GetDeclarationKind(Generator.CompilationUnit())); 3007Assert.Equal(DeclarationKind.Class, Generator.GetDeclarationKind(Generator.ClassDeclaration("c"))); 3008Assert.Equal(DeclarationKind.Struct, Generator.GetDeclarationKind(Generator.StructDeclaration("s"))); 3009Assert.Equal(DeclarationKind.Interface, Generator.GetDeclarationKind(Generator.InterfaceDeclaration("i"))); 3010Assert.Equal(DeclarationKind.Enum, Generator.GetDeclarationKind(Generator.EnumDeclaration("e"))); 3011Assert.Equal(DeclarationKind.Delegate, Generator.GetDeclarationKind(Generator.DelegateDeclaration("d"))); 3012Assert.Equal(DeclarationKind.Method, Generator.GetDeclarationKind(Generator.MethodDeclaration("m"))); 3013Assert.Equal(DeclarationKind.Constructor, Generator.GetDeclarationKind(Generator.ConstructorDeclaration())); 3014Assert.Equal(DeclarationKind.Parameter, Generator.GetDeclarationKind(Generator.ParameterDeclaration("p"))); 3015Assert.Equal(DeclarationKind.Property, Generator.GetDeclarationKind(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 3016Assert.Equal(DeclarationKind.Indexer, Generator.GetDeclarationKind(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 3017Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 3018Assert.Equal(DeclarationKind.EnumMember, Generator.GetDeclarationKind(Generator.EnumMember("v"))); 3019Assert.Equal(DeclarationKind.Event, Generator.GetDeclarationKind(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 3020Assert.Equal(DeclarationKind.CustomEvent, Generator.GetDeclarationKind(Generator.CustomEventDeclaration("e", Generator.IdentifierName("t")))); 3021Assert.Equal(DeclarationKind.Namespace, Generator.GetDeclarationKind(Generator.NamespaceDeclaration("n"))); 3022Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))); 3023Assert.Equal(DeclarationKind.Variable, Generator.GetDeclarationKind(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3024Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(Generator.Attribute("a"))); 3030Assert.Equal("c", Generator.GetName(Generator.ClassDeclaration("c"))); 3031Assert.Equal("s", Generator.GetName(Generator.StructDeclaration("s"))); 3032Assert.Equal("i", Generator.GetName(Generator.EnumDeclaration("i"))); 3033Assert.Equal("e", Generator.GetName(Generator.EnumDeclaration("e"))); 3034Assert.Equal("d", Generator.GetName(Generator.DelegateDeclaration("d"))); 3035Assert.Equal("m", Generator.GetName(Generator.MethodDeclaration("m"))); 3036Assert.Equal("", Generator.GetName(Generator.ConstructorDeclaration())); 3037Assert.Equal("p", Generator.GetName(Generator.ParameterDeclaration("p"))); 3038Assert.Equal("p", Generator.GetName(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")))); 3039Assert.Equal("", Generator.GetName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")))); 3040Assert.Equal("f", Generator.GetName(Generator.FieldDeclaration("f", Generator.IdentifierName("t")))); 3041Assert.Equal("v", Generator.GetName(Generator.EnumMember("v"))); 3042Assert.Equal("ef", Generator.GetName(Generator.EventDeclaration("ef", Generator.IdentifierName("t")))); 3043Assert.Equal("ep", Generator.GetName(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")))); 3044Assert.Equal("n", Generator.GetName(Generator.NamespaceDeclaration("n"))); 3045Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))); 3046Assert.Equal("loc", Generator.GetName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3047Assert.Equal("a", Generator.GetName(Generator.Attribute("a"))); 3053Assert.Equal("c", Generator.GetName(Generator.WithName(Generator.ClassDeclaration("x"), "c"))); 3054Assert.Equal("s", Generator.GetName(Generator.WithName(Generator.StructDeclaration("x"), "s"))); 3055Assert.Equal("i", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "i"))); 3056Assert.Equal("e", Generator.GetName(Generator.WithName(Generator.EnumDeclaration("x"), "e"))); 3057Assert.Equal("d", Generator.GetName(Generator.WithName(Generator.DelegateDeclaration("x"), "d"))); 3058Assert.Equal("m", Generator.GetName(Generator.WithName(Generator.MethodDeclaration("x"), "m"))); 3059Assert.Equal("", Generator.GetName(Generator.WithName(Generator.ConstructorDeclaration(), ".ctor"))); 3060Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.ParameterDeclaration("x"), "p"))); 3061Assert.Equal("p", Generator.GetName(Generator.WithName(Generator.PropertyDeclaration("x", Generator.IdentifierName("t")), "p"))); 3062Assert.Equal("", Generator.GetName(Generator.WithName(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), "this"))); 3063Assert.Equal("f", Generator.GetName(Generator.WithName(Generator.FieldDeclaration("x", Generator.IdentifierName("t")), "f"))); 3064Assert.Equal("v", Generator.GetName(Generator.WithName(Generator.EnumMember("x"), "v"))); 3065Assert.Equal("ef", Generator.GetName(Generator.WithName(Generator.EventDeclaration("x", Generator.IdentifierName("t")), "ef"))); 3066Assert.Equal("ep", Generator.GetName(Generator.WithName(Generator.CustomEventDeclaration("x", Generator.IdentifierName("t")), "ep"))); 3067Assert.Equal("n", Generator.GetName(Generator.WithName(Generator.NamespaceDeclaration("x"), "n"))); 3068Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))); 3069Assert.Equal("loc", Generator.GetName(Generator.WithName(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "x"), "loc"))); 3070Assert.Equal("a", Generator.GetName(Generator.WithName(Generator.Attribute("x"), "a"))); 3076Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal))); 3077Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal))); 3078Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal))); 3079Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal))); 3080Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal))); 3081Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal))); 3082Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal))); 3083Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.ParameterDeclaration("p"))); 3084Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3085Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3086Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3087Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.EnumMember("v"))); 3088Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3089Assert.Equal(Accessibility.Internal, Generator.GetAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal))); 3090Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceDeclaration("n"))); 3091Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))); 3092Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3093Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.Attribute("a"))); 3094Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(TypeParameter("tp"))); 3100Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ClassDeclaration("c", accessibility: Accessibility.Internal), Accessibility.Private))); 3101Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.StructDeclaration("s", accessibility: Accessibility.Internal), Accessibility.Private))); 3102Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("i", accessibility: Accessibility.Internal), Accessibility.Private))); 3103Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumDeclaration("e", accessibility: Accessibility.Internal), Accessibility.Private))); 3104Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.DelegateDeclaration("d", accessibility: Accessibility.Internal), Accessibility.Private))); 3105Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.MethodDeclaration("m", accessibility: Accessibility.Internal), Accessibility.Private))); 3106Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ConstructorDeclaration(accessibility: Accessibility.Internal), Accessibility.Private))); 3107Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.ParameterDeclaration("p"), Accessibility.Private))); 3108Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3109Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3110Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3111Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EnumMember("v"), Accessibility.Private))); 3112Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3113Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), accessibility: Accessibility.Internal), Accessibility.Private))); 3114Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceDeclaration("n"), Accessibility.Private))); 3115Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))); 3116Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Accessibility.Private))); 3117Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.Attribute("a"), Accessibility.Private))); 3118Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(TypeParameter("tp"), Accessibility.Private))); 3119Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(AccessorDeclaration(SyntaxKind.InitAccessorDeclaration), Accessibility.Private))); 3125Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.ClassDeclaration("c", modifiers: DeclarationModifiers.Abstract))); 3126Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.StructDeclaration("s", modifiers: DeclarationModifiers.Partial))); 3127Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.EnumDeclaration("e", modifiers: DeclarationModifiers.New))); 3128Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.DelegateDeclaration("d", modifiers: DeclarationModifiers.New))); 3129Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.MethodDeclaration("m", modifiers: DeclarationModifiers.Static))); 3130Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.ConstructorDeclaration(modifiers: DeclarationModifiers.Static))); 3131Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.ParameterDeclaration("p"))); 3132Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3133Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Abstract))); 3134Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Const))); 3135Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3136Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"), modifiers: DeclarationModifiers.Static))); 3137Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.EnumMember("v"))); 3138Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceDeclaration("n"))); 3139Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))); 3140Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"))); 3141Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.Attribute("a"))); 3142Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(TypeParameter("tp"))); 3148Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), DeclarationModifiers.Abstract))); 3149Assert.Equal(DeclarationModifiers.Partial, Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), DeclarationModifiers.Partial))); 3150Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), DeclarationModifiers.New))); 3151Assert.Equal(DeclarationModifiers.New, Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), DeclarationModifiers.New))); 3152Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), DeclarationModifiers.Static))); 3153Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration(), DeclarationModifiers.Static))); 3154Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.ParameterDeclaration("p"), DeclarationModifiers.Abstract))); 3155Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3156Assert.Equal(DeclarationModifiers.Abstract, Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), DeclarationModifiers.Abstract))); 3157Assert.Equal(DeclarationModifiers.Const, Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), DeclarationModifiers.Const))); 3158Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3159Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), DeclarationModifiers.Static))); 3160Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.EnumMember("v"), DeclarationModifiers.Partial))); 3161Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceDeclaration("n"), DeclarationModifiers.Abstract))); 3162Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract))); 3163Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), DeclarationModifiers.Abstract))); 3164Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.Attribute("a"), DeclarationModifiers.Abstract))); 3165Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(TypeParameter("tp"), DeclarationModifiers.Abstract))); 3175Generator.GetModifiers(Generator.WithModifiers(Generator.ClassDeclaration("c"), allModifiers))); 3179Generator.GetModifiers(Generator.WithModifiers(Generator.StructDeclaration("s"), allModifiers))); 3183Generator.GetModifiers(Generator.WithModifiers(Generator.InterfaceDeclaration("i"), allModifiers))); 3187Generator.GetModifiers(Generator.WithModifiers(Generator.DelegateDeclaration("d"), allModifiers))); 3191Generator.GetModifiers(Generator.WithModifiers(Generator.EnumDeclaration("e"), allModifiers))); 3195Generator.GetModifiers(Generator.WithModifiers(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), allModifiers))); 3199Generator.GetModifiers(Generator.WithModifiers(Generator.ConstructorDeclaration("c"), allModifiers))); 3203Generator.GetModifiers(Generator.WithModifiers(DestructorDeclaration("c"), allModifiers))); 3207Generator.GetModifiers(Generator.WithModifiers(Generator.MethodDeclaration("m"), allModifiers))); 3211Generator.GetModifiers(Generator.WithModifiers(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), allModifiers))); 3215Generator.GetModifiers(Generator.WithModifiers(Generator.IndexerDeclaration([Generator.ParameterDeclaration("i")], Generator.IdentifierName("t")), allModifiers))); 3219Generator.GetModifiers(Generator.WithModifiers(Generator.EventDeclaration("ef", Generator.IdentifierName("t")), allModifiers))); 3223Generator.GetModifiers(Generator.WithModifiers(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t")), allModifiers))); 3227Generator.GetModifiers(Generator.WithModifiers(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration), allModifiers))); 3233var ctor = Generator.ConstructorDeclaration("C", modifiers: DeclarationModifiers.Static); 3240var publicCtor = Generator.WithAccessibility(ctor, Accessibility.Public); 3251var ctor = Generator.ConstructorDeclaration("C", accessibility: Accessibility.Public); 3258var staticCtor = Generator.WithModifiers(ctor, DeclarationModifiers.Static); 3270var fileAbstractClass = Generator.WithModifiers(fileClass, Generator.GetModifiers(fileClass).WithIsAbstract(true)); 3282var filePublicClass = Generator.WithAccessibility(fileClass, Accessibility.Public); 3294var fileAbstractClass = Generator.WithModifiers(abstractClass, Generator.GetModifiers(abstractClass).WithIsFile(true)); 3306var filePublicClass = Generator.WithModifiers(publicClass, Generator.GetModifiers(publicClass).WithIsFile(true)); 3318var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3326var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsVirtual(true)); 3336var updatedProperty = Generator.WithModifiers(property, Generator.GetModifiers(property).WithIsRequired(true)); 3343Assert.Equal("t", Generator.GetType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("t"))).ToString()); 3344Assert.Null(Generator.GetType(Generator.MethodDeclaration("m"))); 3346Assert.Equal("t", Generator.GetType(Generator.FieldDeclaration("f", Generator.IdentifierName("t"))).ToString()); 3347Assert.Equal("t", Generator.GetType(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3348Assert.Equal("t", Generator.GetType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("t"))).ToString()); 3349Assert.Equal("t", Generator.GetType(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))).ToString()); 3351Assert.Equal("t", Generator.GetType(Generator.EventDeclaration("ef", Generator.IdentifierName("t"))).ToString()); 3352Assert.Equal("t", Generator.GetType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("t"))).ToString()); 3354Assert.Equal("t", Generator.GetType(Generator.DelegateDeclaration("t", returnType: Generator.IdentifierName("t"))).ToString()); 3355Assert.Null(Generator.GetType(Generator.DelegateDeclaration("d"))); 3357Assert.Equal("t", Generator.GetType(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "v")).ToString()); 3359Assert.Null(Generator.GetType(Generator.ClassDeclaration("c"))); 3360Assert.Null(Generator.GetType(Generator.IdentifierName("x"))); 3366Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.MethodDeclaration("m", returnType: Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3367Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.FieldDeclaration("f", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3368Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3369Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("pt"))], Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3370Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.ParameterDeclaration("p", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3372Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.DelegateDeclaration("t"), Generator.IdentifierName("t"))).ToString()); 3374Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.EventDeclaration("ef", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3375Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.CustomEventDeclaration("ep", Generator.IdentifierName("x")), Generator.IdentifierName("t"))).ToString()); 3377Assert.Equal("t", Generator.GetType(Generator.WithType(Generator.LocalDeclarationStatement(Generator.IdentifierName("x"), "v"), Generator.IdentifierName("t"))).ToString()); 3378Assert.Null(Generator.GetType(Generator.WithType(Generator.ClassDeclaration("c"), Generator.IdentifierName("t")))); 3379Assert.Null(Generator.GetType(Generator.WithType(Generator.IdentifierName("x"), Generator.IdentifierName("t")))); 3385Assert.Equal(0, Generator.GetParameters(Generator.MethodDeclaration("m")).Count); 3386Assert.Equal(1, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3387Assert.Equal(2, Generator.GetParameters(Generator.MethodDeclaration("m", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3389Assert.Equal(0, Generator.GetParameters(Generator.ConstructorDeclaration()).Count); 3390Assert.Equal(1, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3391Assert.Equal(2, Generator.GetParameters(Generator.ConstructorDeclaration(parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))])).Count); 3393Assert.Equal(1, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("t"))).Count); 3394Assert.Equal(2, Generator.GetParameters(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.ParameterDeclaration("p2", Generator.IdentifierName("t2"))], Generator.IdentifierName("t"))).Count); 3396Assert.Equal(0, Generator.GetParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3397Assert.Equal(1, Generator.GetParameters(Generator.ValueReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3399Assert.Equal(0, Generator.GetParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr"))).Count); 3400Assert.Equal(1, Generator.GetParameters(Generator.VoidReturningLambdaExpression("p1", Generator.IdentifierName("expr"))).Count); 3402Assert.Equal(0, Generator.GetParameters(Generator.DelegateDeclaration("d")).Count); 3403Assert.Equal(1, Generator.GetParameters(Generator.DelegateDeclaration("d", parameters: [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3405Assert.Equal(0, Generator.GetParameters(Generator.ClassDeclaration("c")).Count); 3406Assert.Equal(0, Generator.GetParameters(Generator.IdentifierName("x")).Count); 3412Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.MethodDeclaration("m"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3413Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ConstructorDeclaration(), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3414Assert.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); 3416Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3417Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("expr")), [Generator.LambdaParameter("p")])).Count); 3419Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.DelegateDeclaration("d"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3421Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.ClassDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3422Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.StructDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3423Assert.Equal(1, Generator.GetParameters(Generator.AddParameters(Generator.InterfaceDeclaration("c"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3424Assert.Equal(0, Generator.GetParameters(Generator.AddParameters(Generator.IdentifierName("x"), [Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))])).Count); 3431Assert.Equal("x", Generator.GetExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3432Assert.Equal("x", Generator.GetExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t"), initializer: Generator.IdentifierName("x"))).ToString()); 3433Assert.Equal("x", Generator.GetExpression(Generator.LocalDeclarationStatement("loc", initializer: Generator.IdentifierName("x"))).ToString()); 3436Assert.Null(Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]))); 3437Assert.Equal(1, Generator.GetStatements(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")])).Count); 3438Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3439Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x"))).ToString()); 3440Assert.Equal("x", Generator.GetExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3441Assert.Equal("x", Generator.GetExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x"))).ToString()); 3444Assert.Null(Generator.GetExpression(Generator.IdentifierName("e"))); 3447var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3449method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3451Assert.Equal("x", Generator.GetExpression(method).ToString()); 3456local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3458Assert.Equal("x", Generator.GetExpression(local).ToString()); 3465Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.FieldDeclaration("f", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3466Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.ParameterDeclaration("p", Generator.IdentifierName("t")), Generator.IdentifierName("x"))).ToString()); 3467Assert.Equal("x", Generator.GetExpression(Generator.WithExpression(Generator.LocalDeclarationStatement(Generator.IdentifierName("t"), "loc"), Generator.IdentifierName("x"))).ToString()); 3470Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3471Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", [Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3472Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3473Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression([Generator.IdentifierName("x")]), Generator.IdentifierName("y"))).ToString()); 3474Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3475Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression("p", Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3476Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.ValueReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3477Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(Generator.VoidReturningLambdaExpression(Generator.IdentifierName("x")), Generator.IdentifierName("y"))).ToString()); 3480Assert.Null(Generator.GetExpression(Generator.WithExpression(Generator.IdentifierName("e"), Generator.IdentifierName("x")))); 3483var method = (MethodDeclarationSyntax)Generator.MethodDeclaration("p"); 3485method = method.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3487Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(method, Generator.IdentifierName("y"))).ToString()); 3492local = local.WithExpressionBody(ArrowExpressionClause((ExpressionSyntax)Generator.IdentifierName("x"))); 3494Assert.Equal("y", Generator.GetExpression(Generator.WithExpression(local, Generator.IdentifierName("y"))).ToString()); 3500var prop = Generator.PropertyDeclaration("p", Generator.IdentifierName("T")); 3502Assert.Equal(2, Generator.GetAccessors(prop).Count); 3505var getAccessor = Generator.GetAccessor(prop, DeclarationKind.GetAccessor); 3511Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(getAccessor)); 3514var setAccessor = Generator.GetAccessor(prop, DeclarationKind.SetAccessor); 3516Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(setAccessor)); 3519Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, getAccessor), DeclarationKind.GetAccessor)); 3520Assert.Null(Generator.GetAccessor(Generator.RemoveNode(prop, setAccessor), DeclarationKind.SetAccessor)); 3523Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.WithAccessibility(getAccessor, Accessibility.Public))); 3524Assert.Equal(Accessibility.Private, Generator.GetAccessibility(Generator.WithAccessibility(setAccessor, Accessibility.Private))); 3527Assert.Equal(0, Generator.GetStatements(getAccessor).Count); 3528Assert.Equal(0, Generator.GetStatements(setAccessor).Count); 3530var newGetAccessor = Generator.WithStatements(getAccessor, null); 3534var newNewGetAccessor = Generator.WithStatements(newGetAccessor, []); 3543var newProp = Generator.ReplaceNode(prop, getAccessor, Generator.WithAccessibility(getAccessor, Accessibility.Public)); 3544Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.GetAccessor))); 3546newProp = Generator.ReplaceNode(prop, setAccessor, Generator.WithAccessibility(setAccessor, Accessibility.Public)); 3547Assert.Equal(Accessibility.Public, Generator.GetAccessibility(Generator.GetAccessor(newProp, DeclarationKind.SetAccessor))); 3554Generator.WithAccessorDeclarations(Generator.PropertyDeclaration("p", Generator.IdentifierName("x"))), 3558Generator.WithAccessorDeclarations( 3559Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3560Generator.GetAccessorDeclaration(Accessibility.NotApplicable, [Generator.ReturnStatement()])), 3564Generator.WithAccessorDeclarations( 3565Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3566Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3570Generator.WithAccessorDeclarations( 3571Generator.PropertyDeclaration("p", Generator.IdentifierName("x")), 3572Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3576Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x"))), 3580Generator.WithAccessorDeclarations(Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3581Generator.GetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3585Generator.WithAccessorDeclarations( 3586Generator.IndexerDeclaration([Generator.ParameterDeclaration("p", Generator.IdentifierName("t"))], Generator.IdentifierName("x")), 3587Generator.SetAccessorDeclaration(Accessibility.Protected, [Generator.ReturnStatement()])), 3602var x = Generator.GetMembers(root.Members[0])[0]; 3603var y = Generator.GetMembers(root.Members[0])[1]; 3605Assert.Equal(2, Generator.GetAccessors(x).Count); 3606Assert.Equal(0, Generator.GetAccessors(y).Count); 3609var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3611Assert.Equal(0, Generator.GetAccessors(y2).Count); 3625var x = Generator.GetMembers(root.Members[0])[0]; 3626var y = Generator.GetMembers(root.Members[0])[1]; 3628Assert.Equal(2, Generator.GetAccessors(x).Count); 3629Assert.Equal(0, Generator.GetAccessors(y).Count); 3632var y2 = Generator.AddAccessors(y, [Generator.GetAccessor(x, DeclarationKind.GetAccessor)]); 3634Assert.Equal(0, Generator.GetAccessors(y2).Count); 3650var x = Generator.GetMembers(root.Members[0])[0]; 3651var y = Generator.GetMembers(root.Members[0])[1]; 3652var z = Generator.GetMembers(root.Members[0])[2]; 3654Assert.NotNull(Generator.GetExpression(x)); 3655Assert.NotNull(Generator.GetExpression(y)); 3656Assert.Null(Generator.GetExpression(z)); 3657Assert.Equal("100", Generator.GetExpression(x).ToString()); 3658Assert.Equal("300", Generator.GetExpression(y).ToString()); 3660Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500))).ToString()); 3661Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3662Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(z, Generator.LiteralExpression(500))).ToString()); 3677var x = Generator.GetMembers(root.Members[0])[0]; 3678var y = Generator.GetMembers(root.Members[0])[1]; 3680Assert.Null(Generator.GetExpression(x)); 3681Assert.NotNull(Generator.GetExpression(y)); 3682Assert.Equal("p * 10", Generator.GetExpression(y).ToString()); 3684Assert.Null(Generator.GetExpression(Generator.WithExpression(x, Generator.LiteralExpression(500)))); 3685Assert.Equal("500", Generator.GetExpression(Generator.WithExpression(y, Generator.LiteralExpression(500))).ToString()); 3694Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3697Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3700Assert.Equal(0, Generator.GetStatements(Generator.MethodDeclaration("m")).Count); 3701Assert.Equal(2, Generator.GetStatements(Generator.MethodDeclaration("m", statements: stmts)).Count); 3703Assert.Equal(0, Generator.GetStatements(Generator.ConstructorDeclaration()).Count); 3704Assert.Equal(2, Generator.GetStatements(Generator.ConstructorDeclaration(statements: stmts)).Count); 3706Assert.Equal(0, Generator.GetStatements(Generator.VoidReturningLambdaExpression([])).Count); 3707Assert.Equal(2, Generator.GetStatements(Generator.VoidReturningLambdaExpression(stmts)).Count); 3709Assert.Equal(0, Generator.GetStatements(Generator.ValueReturningLambdaExpression([])).Count); 3710Assert.Equal(2, Generator.GetStatements(Generator.ValueReturningLambdaExpression(stmts)).Count); 3712Assert.Equal(0, Generator.GetStatements(Generator.IdentifierName("x")).Count); 3721Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3724Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3727Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.MethodDeclaration("m"), stmts)).Count); 3728Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ConstructorDeclaration(), stmts)).Count); 3729Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.VoidReturningLambdaExpression([]), stmts)).Count); 3730Assert.Equal(2, Generator.GetStatements(Generator.WithStatements(Generator.ValueReturningLambdaExpression([]), stmts)).Count); 3732Assert.Equal(0, Generator.GetStatements(Generator.WithStatements(Generator.IdentifierName("x"), stmts)).Count); 3741Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3744Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3747var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3750Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3751Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3753Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3754Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), getAccessorStatements: stmts)).Count); 3756Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.IdentifierName("x")).Count); 3759Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"))).Count); 3760Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3762Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"))).Count); 3763Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t"), setAccessorStatements: stmts)).Count); 3765Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.IdentifierName("x")).Count); 3774Generator.ExpressionStatement(Generator.AssignmentStatement(Generator.IdentifierName("x"), Generator.IdentifierName("y"))), 3777Generator.ExpressionStatement(Generator.InvocationExpression(Generator.IdentifierName("fn"), Generator.IdentifierName("arg"))) 3780var p = Generator.ParameterDeclaration("p", Generator.IdentifierName("t")); 3783Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3784Assert.Equal(2, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3785Assert.Equal(0, Generator.GetGetAccessorStatements(Generator.WithGetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3788Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.PropertyDeclaration("p", Generator.IdentifierName("t")), stmts)).Count); 3789Assert.Equal(2, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IndexerDeclaration([p], Generator.IdentifierName("t")), stmts)).Count); 3790Assert.Equal(0, Generator.GetSetAccessorStatements(Generator.WithSetAccessorStatements(Generator.IdentifierName("x"), stmts)).Count); 3803var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3816var baseListB = Generator.GetBaseAndInterfaceTypes(classB); 3828var baseListN = Generator.GetBaseAndInterfaceTypes(classN); 3843var baseListBI = Generator.GetBaseAndInterfaceTypes(classBI); 3847Generator.RemoveNode(classBI, baseListBI[0]), 3855Generator.RemoveNode(classBI, baseListBI[1]), 3863Generator.RemoveNodes(classBI, baseListBI), 3896Generator.AddBaseType(classC, Generator.IdentifierName("T")), 3904Generator.AddBaseType(classCI, Generator.IdentifierName("T")), 3913Generator.AddBaseType(classCB, Generator.IdentifierName("T")), 3946Generator.AddInterfaceType(classC, Generator.IdentifierName("T")), 3954Generator.AddInterfaceType(classCI, Generator.IdentifierName("T")), 3962Generator.AddInterfaceType(classCB, Generator.IdentifierName("T")), 3986var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3987var declX = Generator.GetDeclaration(symbolX.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3988var declY = Generator.GetDeclaration(symbolY.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3989var declZ = Generator.GetDeclaration(symbolZ.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 3991Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declX)); 3992Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declY)); 3993Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(declZ)); 3995Assert.NotNull(Generator.GetType(declX)); 3996Assert.Equal("int", Generator.GetType(declX).ToString()); 3997Assert.Equal("X", Generator.GetName(declX)); 3998Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declX)); 3999Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declX)); 4001Assert.NotNull(Generator.GetType(declY)); 4002Assert.Equal("int", Generator.GetType(declY).ToString()); 4003Assert.Equal("Y", Generator.GetName(declY)); 4004Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declY)); 4005Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declY)); 4007Assert.NotNull(Generator.GetType(declZ)); 4008Assert.Equal("int", Generator.GetType(declZ).ToString()); 4009Assert.Equal("Z", Generator.GetName(declZ)); 4010Assert.Equal(Accessibility.Public, Generator.GetAccessibility(declZ)); 4011Assert.Equal(DeclarationModifiers.Static, Generator.GetModifiers(declZ)); 4013var xTypedT = Generator.WithType(declX, Generator.IdentifierName("T")); 4014Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xTypedT)); 4016Assert.Equal("T", Generator.GetType(xTypedT).ToString()); 4018var xNamedQ = Generator.WithName(declX, "Q"); 4019Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xNamedQ)); 4021Assert.Equal("Q", Generator.GetName(xNamedQ).ToString()); 4023var xInitialized = Generator.WithExpression(declX, Generator.IdentifierName("e")); 4024Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xInitialized)); 4026Assert.Equal("e", Generator.GetExpression(xInitialized).ToString()); 4028var xPrivate = Generator.WithAccessibility(declX, Accessibility.Private); 4029Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xPrivate)); 4031Assert.Equal(Accessibility.Private, Generator.GetAccessibility(xPrivate)); 4033var xReadOnly = Generator.WithModifiers(declX, DeclarationModifiers.ReadOnly); 4034Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xReadOnly)); 4036Assert.Equal(DeclarationModifiers.ReadOnly, Generator.GetModifiers(xReadOnly)); 4038var xAttributed = Generator.AddAttributes(declX, Generator.Attribute("A")); 4039Assert.Equal(DeclarationKind.Field, Generator.GetDeclarationKind(xAttributed)); 4041Assert.Equal(1, Generator.GetAttributes(xAttributed).Count); 4042Assert.Equal("[A]", Generator.GetAttributes(xAttributed)[0].ToString()); 4044var membersC = Generator.GetMembers(declC); 4051Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4061Generator.InsertMembers(declC, 1, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4072Generator.InsertMembers(declC, 2, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4083Generator.InsertMembers(declC, 3, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4093Generator.ClassDeclaration("C", members: [declX, declY]), 4103Generator.ReplaceNode(declC, declX, xTypedT), 4113Generator.ReplaceNode(declC, declY, Generator.WithType(declY, Generator.IdentifierName("T"))), 4124Generator.ReplaceNode(declC, declZ, Generator.WithType(declZ, Generator.IdentifierName("T"))), 4134Generator.ReplaceNode(declC, declX, Generator.WithAccessibility(declX, Accessibility.Private)), 4144Generator.ReplaceNode(declC, declX, Generator.WithModifiers(declX, DeclarationModifiers.None)), 4153Generator.ReplaceNode(declC, declX, Generator.WithName(declX, "Q")), 4161Generator.ReplaceNode(declC, declX.GetAncestorOrThis<VariableDeclaratorSyntax>(), VariableDeclarator("Q")), 4170Generator.ReplaceNode(declC, declX, Generator.WithExpression(declX, Generator.IdentifierName("e"))), 4190var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4193Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4211var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4214Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4235var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4238Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4256var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4259Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4277var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4280Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4298var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4301Generator.InsertMembers(declC, 0, Generator.PropertyDeclaration("A", Generator.IdentifierName("T"))), 4319var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4322Generator.InsertMembers(declC, 0, Generator.EnumMember("A")), 4340var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4343Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4361var declC = Generator.GetDeclaration(symbolC.DeclaringSyntaxReferences.Select(x => x.GetSyntax()).First()); 4364Generator.InsertMembers(declC, 0, Generator.FieldDeclaration("A", Generator.IdentifierName("T"))), 4385var attrs = Generator.GetAttributes(declC); 4392Assert.Equal("X", Generator.GetName(attrX)); 4393Assert.Equal("Y", Generator.GetName(attrY)); 4394Assert.Equal("Z", Generator.GetName(attrZ)); 4396var xNamedQ = Generator.WithName(attrX, "Q"); 4397Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4401var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4402Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4408Generator.InsertAttributes(declC, 0, Generator.Attribute("A")), 4418Generator.InsertAttributes(declC, 1, Generator.Attribute("A")), 4429Generator.InsertAttributes(declC, 2, Generator.Attribute("A")), 4440Generator.InsertAttributes(declC, 3, Generator.Attribute("A")), 4451Generator.RemoveNodes(declC, [attrX]), 4460Generator.RemoveNodes(declC, [attrY]), 4469Generator.RemoveNodes(declC, [attrZ]), 4478Generator.RemoveNodes(declC, [attrX, attrY]), 4487Generator.RemoveNodes(declC, [attrX, attrZ]), 4496Generator.RemoveNodes(declC, [attrY, attrZ]), 4505Generator.RemoveNodes(declC, [attrX, attrY, attrZ]), 4514Generator.ReplaceNode(declC, attrX, Generator.Attribute("A")), 4523Generator.ReplaceNode(declC, attrY, Generator.Attribute("A")), 4532Generator.ReplaceNode(declC, attrZ, Generator.Attribute("A")), 4541Generator.ReplaceNode(declC, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4569Generator.MethodDeclaration(method), 4573Generator.IndexerDeclaration(indexer), 4577Generator.PropertyDeclaration(property), 4596var declM = Generator.GetMembers(declC).First(); 4598Assert.Equal(0, Generator.GetAttributes(declM).Count); 4600var attrs = Generator.GetReturnAttributes(declM); 4606Assert.Equal("X", Generator.GetName(attrX)); 4607Assert.Equal("Y", Generator.GetName(attrY)); 4608Assert.Equal("Z", Generator.GetName(attrZ)); 4610var xNamedQ = Generator.WithName(attrX, "Q"); 4611Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xNamedQ)); 4615var xWithArg = Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))]); 4616Assert.Equal(DeclarationKind.Attribute, Generator.GetDeclarationKind(xWithArg)); 4622Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("A")), 4632Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("A")), 4643Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("A")), 4654Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("A")), 4665Generator.ReplaceNode(declM, attrX, Generator.Attribute("Q")), 4674Generator.ReplaceNode(declM, attrX, Generator.AddAttributeArguments(attrX, [Generator.AttributeArgument(Generator.IdentifierName("e"))])), 4702var declM = Generator.GetMembers(declC).First(); 4704var attrs = Generator.GetAttributes(declM); 4708Assert.Equal("X", Generator.GetName(attrX)); 4712Assert.Equal("Y", Generator.GetName(attrY)); 4716Assert.Equal("Z", Generator.GetName(attrZ)); 4720Assert.Equal("P", Generator.GetName(attrP)); 4723var rattrs = Generator.GetReturnAttributes(declM); 4727Assert.Equal("A", Generator.GetName(attrA)); 4731Assert.Equal("B", Generator.GetName(attrB)); 4735Assert.Equal("C", Generator.GetName(attrC)); 4739Assert.Equal("D", Generator.GetName(attrD)); 4744Generator.InsertAttributes(declM, 0, Generator.Attribute("Q")), 4758Generator.InsertAttributes(declM, 1, Generator.Attribute("Q")), 4772Generator.InsertAttributes(declM, 2, Generator.Attribute("Q")), 4787Generator.InsertAttributes(declM, 3, Generator.Attribute("Q")), 4801Generator.InsertAttributes(declM, 4, Generator.Attribute("Q")), 4815Generator.InsertReturnAttributes(declM, 0, Generator.Attribute("Q")), 4829Generator.InsertReturnAttributes(declM, 1, Generator.Attribute("Q")), 4843Generator.InsertReturnAttributes(declM, 2, Generator.Attribute("Q")), 4858Generator.InsertReturnAttributes(declM, 3, Generator.Attribute("Q")), 4873Generator.InsertReturnAttributes(declM, 4, Generator.Attribute("Q")), 4898var newDecl = Generator.AddInterfaceType(decl, Generator.IdentifierName("IDisposable")); 4918Generator.Declaration(symbolR), 4933Generator.Declaration(symbolR), 4956Generator.Declaration(symbolR), 4971Generator.Declaration(symbolR), 4994Generator.Declaration(symbol), 5014Generator.Declaration(symbol), 5032Generator.Declaration(symbol), 5049Generator.Declaration(symbol), 5074Generator.Declaration(symbol), 5219Generator.Declaration(symbol), 5277Generator.Attribute(attribute), 5285Generator.TypeExpression(type),