private EmitNodeVisitor(EmitExpressionVisitor expressionVisitor) : base(expressionVisitor) { _expressionVisitor = expressionVisitor; }
public bool BeforeVisit(Statement statement) { var expression = statement.Expression; var iterationExpression = expression as IterationExpression; if (iterationExpression != null) { var scope = new Scope(); _scopes.Push(scope); var visitor = new EmitExpressionVisitor(_dataBinder, new NullHelperBinder()); iterationExpression.Expression.Accept(visitor); var context = _dataBinder.Context(); IEvaluator<IEnumerable> evaluator; if (!context.TryCreateEvaluation(out evaluator)) return false; Action<TextWriter, IDataContext, IRenderingContext> ext = (writer, dataContext, renderingContext) => { var items = evaluator.Evaluate(dataContext); foreach (var item in items) { } }; scope.Elements.Add(ext); //IEvaluator<string> evaluator; //if (result.TryCreateEvaluation(out evaluator)) //{ // scope.Elements.Add((writer, dataContext, renderingContext) => // { // var value = evaluator.Evaluate(dataContext); // writer.Write(value); // }); //} } return true; }