Exemple #1
0
        public static void Transpile(this Syntax.ReturnStatementSyntax returnStatementNode, ref StringBuilder sb)
        {
            _ = returnStatementNode ?? throw new ArgumentNullException(nameof(returnStatementNode));

            if (returnStatementNode.EmptyExpressionNode is null)
            {
                sb.Append("return ");
                returnStatementNode.ExpressionNode?.Transpile(ref sb);
            }
            else
            {
                sb.Append("return");
            }
        }
Exemple #2
0
        public static StatementSyntax Transpile(this Syntax.ReturnStatementSyntax returnStatementNode)
        {
            _ = returnStatementNode ?? throw new ArgumentNullException(nameof(returnStatementNode));

            return(SyntaxFactory.ReturnStatement(returnStatementNode.ExpressionNode?.Transpile()));
        }