public static IValue Evaluate(IExpression expression, Func <string, IValue> getAnswer)
        {
            var evaluator = new QLExpressionEvaluator(getAnswer);

            try
            {
                expression.Accept(evaluator);
            }
            catch (RuntimeBinderException)
            {
                throw new InvalidExpressionException(expression);
            }
            return(evaluator._result);
        }
Esempio n. 2
0
 private bool EvaluateCondition(IExpression expression) => QLExpressionEvaluator.AsBool(QLExpressionEvaluator.Evaluate(expression, GetAnswer));
Esempio n. 3
0
 public void Visit(ComputedQuestion question)
 {
     _answers[question.Id] = QLExpressionEvaluator.Evaluate(question.Computation, GetAnswer);
     AddQuestion(question, true);
 }