protected override Expression VisitDeferredSectionExpression(DeferredSectionExpression dsex)
 {
     Action<object, BindingContext, Action<TextWriter, object>> method;
     if(dsex.Path.Path.StartsWith("#"))
     {
         method = RenderSection;
     }
     else if(dsex.Path.Path.StartsWith("^"))
     {
         method = RenderEmptySection;
     }
     else
     {
         throw new HandlebarsCompilerException("Tried to compile a section expression that did not begin with # or ^");
     }
     return Expression.Call(
         method.Method,
         HandlebarsExpression.Path(dsex.Path.Path.Substring(1)),
         _context.BindingContext,
         new FunctionBuilder(_context.Configuration).Compile(dsex.Body, _context.BindingContext));
 }
        protected override Expression VisitDeferredSectionExpression(DeferredSectionExpression dsex)
        {
            Action <object, BindingContext, Action <TextWriter, object> > method;

            if (dsex.Path.Path.StartsWith("#"))
            {
                method = RenderSection;
            }
            else if (dsex.Path.Path.StartsWith("^"))
            {
                method = RenderEmptySection;
            }
            else
            {
                throw new HandlebarsCompilerException("Tried to compile a section expression that did not begin with # or ^");
            }
            return(Expression.Call(
                       method.Method,
                       HandlebarsExpression.Path(dsex.Path.Path.Substring(1)),
                       _context.BindingContext,
                       new FunctionBuilder(_context.Configuration).Compile(dsex.Body, _context.BindingContext)));
        }
 protected virtual Expression VisitDeferredSectionExpression(DeferredSectionExpression dsex)
 {
     return dsex;
 }
Example #4
0
 protected virtual Expression VisitDeferredSectionExpression(DeferredSectionExpression dsex)
 {
     return(dsex);
 }