private TypeDeclarationSyntax BuildStruct(DiscriminatedUnionContext <StructDiscriminatedUnionCase> context) { var casesClass = CreateEmptyCasesPartialClass(); casesClass = casesClass.WithMembers(List(context.Cases.SelectMany(c => c.Members))); var members = context.Members.Add(casesClass); return(context.WithMembers(List(members)).GeneratedPartialClass); }
private TypeDeclarationSyntax BuildClass(DiscriminatedUnionContext <DiscriminatedUnionCase> context) { var casesPartialClass = CreateEmptyCasesPartialClass(); return(context.WithMembers( List( context.Members.Add( casesPartialClass.WithMembers( List( context.Cases .Select(c => c.GeneratedPartialClass.WithMembers(List(c.Members))) .Cast <MemberDeclarationSyntax>() ) ) ) ) ) .GeneratedPartialClass); }