示例#1
0
        public override Argument VisitVarExpression(CalcParser.VarExpressionContext context)
        {
            Argument arg = Visit(context.expression());

            if (arg.IsNull)
            {
                return(Argument.Null);
            }

            if (arg.IsDouble || arg.IsDate)
            {
                throw new ArgumentCastException("Argument of $VAR macro should not be a number or a date");
            }

            String variableName = arg.ToString();

            return(this._resolver.ResolveVariable(variableName));
        }
示例#2
0
        public override Query VisitVarExpression(CalcParser.VarExpressionContext context)
        {
            Query  variableQuery = Visit(context.expression());
            string variableName  = variableQuery.Text;

            Argument arg = this._metadataResolver.ResolveVariable(variableName);

            ResultType type = ResultType.String;

            if (arg.IsDate)
            {
                type = ResultType.Date;
            }

            if (arg.IsDouble)
            {
                type = ResultType.Number;
            }

            string queryText = TranslateArgument(arg);

            return(new Query(queryText, type));
        }