public static BlockHelper ( string helperName, IEnumerable |
||
helperName | string | |
arguments | IEnumerable |
|
body | ||
inversion | ||
Résultat | HandlebarsDotNet.Compiler.BlockHelperExpression |
public override Expression GetAccumulatedBlock() { if (_accumulatedBody == null) { _accumulatedBody = GetBlockBody(); _accumulatedInversion = Expression.Block(Expression.Empty()); } else if (_accumulatedInversion == null) { _accumulatedInversion = GetBlockBody(); } var resultExpr = HandlebarsExpression.BlockHelper( _startingNode.HelperName, _startingNode.Arguments.Where(o => o.NodeType != (ExpressionType)HandlebarsExpressionType.BlockParamsExpression), _startingNode.Arguments.OfType <BlockParamsExpression>().SingleOrDefault() ?? BlockParamsExpression.Empty(), _accumulatedBody, _accumulatedInversion, _startingNode.IsRaw); if (_startingNode.IsRaw) { return(HandlebarsExpression.Statement( resultExpr, false, _trimBefore, _trimAfter)); } return(resultExpr); }
public override Expression GetAccumulatedBlock() { if (_accumulatedBody == null) { _accumulatedBody = GetBlockBody(); _accumulatedInversion = Expression.Block(Expression.Empty()); } else if (_accumulatedInversion == null) { _accumulatedInversion = GetBlockBody(); } var resultExpr = HandlebarsExpression.BlockHelper( _startingNode.HelperName, _startingNode.Arguments, _accumulatedBody, _accumulatedInversion, _startingNode.IsRaw); if (_startingNode.IsRaw) { return(HandlebarsExpression.Statement( resultExpr, false, _trimBefore, _trimAfter)); } return(resultExpr); }
protected override Expression VisitBlockHelperExpression(BlockHelperExpression bhex) { return(HandlebarsExpression.BlockHelper( bhex.HelperName, bhex.Arguments.Select(arg => Visit(arg)), Visit(bhex.Body), Visit(bhex.Inversion))); }
protected virtual Expression VisitBlockHelperExpression(BlockHelperExpression bhex) { var arguments = VisitExpressionList(bhex.Arguments); // Don't visit Body/Inversion - they will be compiled separately if (arguments != bhex.Arguments) { return(HandlebarsExpression.BlockHelper(bhex.HelperName, arguments, bhex.BlockParams, bhex.Body, bhex.Inversion, bhex.IsRaw)); } return(bhex); }
public override Expression GetAccumulatedBlock() { if (_accumulatedBody == null) { _accumulatedBody = GetBlockBody(); _accumulatedInversion = Expression.Block(Expression.Empty()); } else if (_accumulatedInversion == null) { _accumulatedInversion = GetBlockBody(); } return(HandlebarsExpression.BlockHelper( _startingNode.HelperName, _startingNode.Arguments, _accumulatedBody, _accumulatedInversion)); }