public object VisitUnaryExpr(UnaryExpr expr) { var right = Evaluate(expr.Right); switch (expr.Operator.Type) { case TokenType.Bang: return(!IsTruthy(right)); case TokenType.Minus: CheckNumberOperand(expr.Operator, right); return(-(double)right); } // unreachable return(null); }
public void VisitUnaryExpr(UnaryExpr expr) { Resolve(expr.Right); }
public string VisitUnaryExpr(UnaryExpr expr) { return(Parenthesize(expr.Operator.Lexeme, expr.Right)); }