public override Query VisitAbsExpression(CalcParser.AbsExpressionContext context) { Query q = Visit(context.expression()); ResultType type = ResultType.Undefined; if (q.ExpectedResult == ResultType.Number) { type = ResultType.Number; } return(new Query($"ABS({q})", type)); }
public override Argument VisitAbsExpression(CalcParser.AbsExpressionContext context) { Argument arg = Visit(context.expression()); if (arg.IsNull) { return(Argument.Null); } if (arg.IsDouble) { return(new Argument(Math.Abs(arg.ToDouble()))); } throw ArgumentCastException.Create("double", arg); }