Beispiel #1
0
        public static ITranslation For(ConditionalExpression conditional, ITranslationContext context)
        {
            var hasNoElseCondition = HasNoElseCondition(conditional);

            if (hasNoElseCondition)
            {
                return(new IfStatementTranslation(conditional, context));
            }

            if (conditional.IsTernary())
            {
                return(new TernaryTranslation(conditional, context));
            }

            if (conditional.IfTrue.IsReturnable())
            {
                return(new ShortCircuitingIfTranslation(conditional, context));
            }

            return(new IfElseTranslation(conditional, context));
        }