Example #1
0
        public object VisitLogicalExpr(Logical expr)
        {
            object left = Evaluate(expr.Left);

            if (expr.Operator.Type == TokenType.OR)
            {
                if (IsTruthy(left))
                {
                    return(left);
                }
            }
            if (expr.Operator.Type == TokenType.AND)
            {
                if (!IsTruthy(left))
                {
                    return(left);
                }
            }

            return(Evaluate(expr.Right));
        }
Example #2
0
 public object visit_Logical_Expr(Logical expr)
 {
     resolve(expr.right);
     resolve(expr.left);
     return(null);
 }
Example #3
0
 public object VisitLogicalExpr(Logical expr)
 {
     Resolve(expr.Left);
     Resolve(expr.Right);
     return(null);
 }
Example #4
0
 public string VisitLogicalExpr(Logical expr) => $"{expr.Operator.Type}";