예제 #1
0
 public object visitTernaryExpr(Expr.Ternary expr)
 {
     Resolve(expr.condition);
     Resolve(expr.conditionTrueValue);
     Resolve(expr.conditionFalseValue);
     return(null);
 }
예제 #2
0
        public object visitTernaryExpr(Expr.Ternary expr)
        {
            object conditionExpr = Evaluate(expr.condition);
            bool   condition     = GetTruthValue(conditionExpr);

            return(condition ? Evaluate(expr.conditionTrueValue) : Evaluate(expr.conditionFalseValue));
        }
예제 #3
0
 public string visitTernaryExpr(Expr.Ternary expr)
 {
     return(parenthesize("IF" + expr.condition.accept(this)) + " THEN " + expr.conditionTrueValue.accept(this)
            + " ELSE " + expr.conditionFalseValue.accept(this));
 }