visitUnaryExpr method
Implementation
@override
Object? visitUnaryExpr(Expr.Unary expr) {
Object? right = evaluate(expr.right);
switch (expr.operator.type) {
case TokenType.BANG:
return !isTruthy(right);
case TokenType.MINUS:
checkNumberOperand(expr.operator, right);
return -(right as num);
}
return null;
}