protected internal override ExpressionSlim VisitLoop(LoopExpressionSlim node) { var count = 0; Append("Loop("); DoLabel(node.ContinueLabel); DoExpr(node.Body); DoLabel(node.BreakLabel); Append(')'); return(node); void DoLabel(LabelTargetSlim target) { if (target != null) { if (count > 0) { Append(", "); } VisitLabelTarget(target); count++; } } void DoExpr(ExpressionSlim expr) { if (count > 0) { Append(", "); } Visit(expr); count++; } }
/// <summary> /// Visits a loop expression slim tree node, produces a loop expression. /// </summary> /// <param name="node">Node to visit.</param> /// <param name="body">Body expression.</param> /// <param name="breakLabel">Break label.</param> /// <param name="continueLabel">Continue label.</param> /// <returns>The loop expression represented by the expression slim node.</returns> protected override Expression MakeLoop(LoopExpressionSlim node, Expression body, LabelTarget breakLabel, LabelTarget continueLabel) { return(_factory.Loop(body, breakLabel, continueLabel)); }
/// <summary> /// Visits a loop expression tree node. /// </summary> /// <param name="node">Node to visit.</param> /// <returns>Result of visiting the node.</returns> protected internal virtual ExpressionSlim VisitLoop(LoopExpressionSlim node) { return(node.Update(VisitIfNotNull(node.BreakLabel, VisitLabelTarget), VisitIfNotNull(node.ContinueLabel, VisitLabelTarget), Visit(node.Body))); }