コード例 #1
0
        public void Visit(LiquidExpressionTree liquidExpressionTree)
        {
            var result = LiquidExpressionEvaluator.Eval(liquidExpressionTree, _templateContext);

            result.WhenSuccess(success => success.WhenSome(x => AppendTextToCurrentAccumulator(Render(x))))
            .WhenError(error =>
            {
                RegisterRenderingError(error);
                //RenderingErrors.Add(error);
                //RenderError(error);
            });
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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));
        }
コード例 #4
0
 public void Visit(LiquidExpressionTree liquidExpressionTree)
 {
     _result += liquidExpressionTree.ToString();
 }
コード例 #5
0
 public void Visit(LiquidExpressionTree liquidExpressionTree)
 {
     _result += liquidExpressionTree.ToString();
 }
コード例 #6
0
 public void Visit(LiquidExpressionTree liquidExpressionTree)
 {
     LiquidExpressionEvaluator.Eval(liquidExpressionTree, _templateContext)
         .WhenSuccess(success => success.WhenSome(x => AppendTextToCurrentAccumulator(Render(x))))
         .WhenError(RenderError);
 }