public override void Visit(TernaryExpression expression)
        {
            EncapsulateNoValue(expression.LeftExpression);

            Result.Append("? ");

            EncapsulateNoValue(expression.MiddleExpression);

            Result.Append(": ");

            EncapsulateNoValue(expression.RightExpression);
        }
Exemple #2
0
        public override void Visit(TernaryExpression expression)
        {
            // Evaluates the left expression and saves the value
            expression.LeftExpression.Accept(this);
            bool left = Convert.ToBoolean(Result);

            if (left)
            {
                expression.MiddleExpression.Accept(this);
            }
            else
            {
                expression.RightExpression.Accept(this);
            }
        }