示例#1
0
        protected internal override Expression VisitConditionalAccess(ConditionalAccessCSharpExpression node)
        {
            var receiver        = new XElement(nameof(node.Receiver), Visit(node.Receiver));
            var nonNullReceiver = new XElement(nameof(node.NonNullReceiver), Visit(node.NonNullReceiver));
            var whenNotNull     = new XElement(nameof(node.WhenNotNull), Visit(node.WhenNotNull));

            return(Push(node, receiver, nonNullReceiver, whenNotNull));
        }
        protected internal virtual Expression VisitConditionalAccess <TExpression>(ConditionalAccessCSharpExpression <TExpression> node)
            where TExpression : Expression
        {
            // DESIGN: We can do away with this if we decide to scrap ConditionalAccessCSharpExpression<TExpression> and/or
            //         the specialized conditional node types. We could keep the factories as a convenience to construct the
            //         underyling ConditionalAccess construct.

            return(node.AcceptConditionalAccess(this));
        }
 protected internal virtual Expression VisitConditionalAccess(ConditionalAccessCSharpExpression node) =>
 node.Update(
     Visit(node.Receiver),
     VisitAndConvert(node.NonNullReceiver, nameof(VisitConditionalAccess)),
     Visit(node.WhenNotNull)
     );
            protected internal override Expression VisitConditionalAccess <TWhenNotNull>(ConditionalAccessCSharpExpression <TWhenNotNull> node)
            {
                if (node.NonNullReceiver == _receiver)
                {
                    var receiver = Visit(node.Receiver);
                    return(node.Update(receiver, node.NonNullReceiver, node.WhenNotNull));
                }

                return(base.VisitConditionalAccess(node));
            }
 public ConditionalAccessCSharpExpressionProxy(ConditionalAccessCSharpExpression node)
 {
     _node = node;
 }