/// <summary>
 /// Visits a switch expression slim tree node, produces a switch expression.
 /// </summary>
 /// <param name="node">Node to visit.</param>
 /// <param name="switchValue">Switch value expression.</param>
 /// <param name="defaultBody">Default body expression.</param>
 /// <param name="cases">Switch cases.</param>
 /// <returns>The switch expression represented by the expression slim node.</returns>
 protected override Expression MakeSwitch(SwitchExpressionSlim node, Expression switchValue, Expression defaultBody, ReadOnlyCollection <SwitchCase> cases)
 {
     return(_factory.Switch(
                VisitIfNotNull(node.Type, MakeTypeCachedDelegate),
                switchValue,
                defaultBody,
                VisitIfNotNull(node.Comparison, MakeMethodCachedDelegate),
                cases
                ));
 }
Exemple #2
0
        protected internal override ExpressionSlim VisitSwitch(SwitchExpressionSlim node)
        {
            Append("Switch(");
            Visit(node.SwitchValue);
            if (node.Comparison != null)
            {
                Append(", ");
                Append(node.Comparison);
            }
            Append(", ");
            Visit(", ", node.Cases, VisitSwitchCase);
            VisitNonNull(", ", node.DefaultBody);
            Append(')');

            return(node);
        }
 /// <summary>
 /// Visits a switch expression tree node.
 /// </summary>
 /// <param name="node">Node to visit.</param>
 /// <returns>Result of visiting the node.</returns>
 protected internal virtual ExpressionSlim VisitSwitch(SwitchExpressionSlim node)
 {
     return(node.Update(Visit(node.SwitchValue), Visit(node.Cases, VisitSwitchCase), Visit(node.DefaultBody)));
 }