Пример #1
0
        public override SyntaxNode VisitYieldStatement(YieldStatementSyntax node)
        {
            if (node.IsKind(SyntaxKind.YieldBreakStatement))
            {
                return(GetYieldReturnStatement(node.GetLeadingTrivia()));
            }

            var addYield = ExpressionStatement(
                InvocationExpression(
                    MemberAccessExpression(
                        SyntaxKind.SimpleMemberAccessExpression,
                        IdentifierName(Identifier(TriviaList(node.GetLeadingTrivia()), "yields", TriviaList())),
                        IdentifierName("Add")))
                .WithArgumentList(
                    ArgumentList(
                        SingletonSeparatedList(
                            Argument(node.Expression)))))
                           .WithSemicolonToken(Token(TriviaList(), SyntaxKind.SemicolonToken, TriviaList(_transformResult.EndOfLineTrivia)));

            return(addYield);
        }