public static LiquidExpressionResult Eval(
     LiquidExpressionTree expressiontree, 
     ITemplateContext templateContext)
 {
     // Evaluate the children, depth first
     var leaves = expressiontree.ExpressionTree.Children.Select(x => Eval(x, templateContext)).ToList();
     if (leaves.Any(x => x.IsError))
     {
         return leaves.First(x => x.IsError); // TODO: maybe aggregate tehse
     }
     // pass the results to the parent
     return Eval(expressiontree.ExpressionTree.Data, leaves.Select(x => x.SuccessResult), templateContext);
 }
Ejemplo n.º 2
0
 public void Visit(LiquidExpressionTree liquidExpressionTree)
 {
     _result += liquidExpressionTree.ToString();
 }
Ejemplo n.º 3
0
 public void Visit(LiquidExpressionTree liquidExpressionTree)
 {
     LiquidExpressionEvaluator.Eval(liquidExpressionTree, _templateContext)
         .WhenSuccess(success => success.WhenSome(x => AppendTextToCurrentAccumulator(Render(x))))
         .WhenError(RenderError);
 }