private static MemberDeclarationSyntax GetMatchMethod(DiscriminatedUnionContext <StructDiscriminatedUnionCase> context) { var match = GeneratorHelpers.CreateMatchMethod(context.Cases.Cast <IDiscriminatedUnionCase>(), context.MatchGenericParameter) .WithModifiers( TokenList( Token(SyntaxKind.PublicKeyword) ) ) .WithBody(GetMatchBlock(context.Cases)); return(match); }
private static MemberDeclarationSyntax GetAbstractMatchMethod(DiscriminatedUnionContext <DiscriminatedUnionCase> context) { var match = GeneratorHelpers.CreateMatchMethod(context.Cases.Cast <IDiscriminatedUnionCase>(), context.MatchGenericParameter) .WithModifiers( TokenList( Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.AbstractKeyword) ) ) .WithSemicolonToken(Token(SyntaxKind.SemicolonToken)); return(match); }
private static MemberDeclarationSyntax GetMatchImplementation( DiscriminatedUnionContext <DiscriminatedUnionCase> context, DiscriminatedUnionCase currentCase) { var match = GeneratorHelpers.CreateMatchMethod(context.Cases.Cast <IDiscriminatedUnionCase>(), context.MatchGenericParameter) .WithModifiers( TokenList( Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.OverrideKeyword) ) ) .WithBody(GetMatchBlock(context.Cases, currentCase)); return(match); }