コード例 #1
0
 public override sealed object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
 {
     this.BeginVisit(conditionalExpression);
     object result = this.TrackedVisitConditionalExpression(conditionalExpression, data);
     this.EndVisit(conditionalExpression);
     return result;
 }
コード例 #2
0
 public virtual object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
 {
     return base.VisitConditionalExpression(conditionalExpression, data);
 }
コード例 #3
0
 public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
 {
     Debug.Assert((conditionalExpression != null));
     Debug.Assert((conditionalExpression.Condition != null));
     Debug.Assert((conditionalExpression.TrueExpression != null));
     Debug.Assert((conditionalExpression.FalseExpression != null));
     conditionalExpression.Condition.AcceptVisitor(this, data);
     conditionalExpression.TrueExpression.AcceptVisitor(this, data);
     return conditionalExpression.FalseExpression.AcceptVisitor(this, data);
 }
コード例 #4
0
 public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
 {
     throw new global::System.NotImplementedException("ConditionalExpression");
 }
コード例 #5
0
ファイル: Parser.cs プロジェクト: richardschneider/ILSpy
        void ConditionalExpression(out Expression expr)
        {
            ConditionalExpression conditionalExpression = new ConditionalExpression();
            BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
            conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;

            Expression condition = null;
            Expression trueExpr = null;
            Expression falseExpr = null;

            Expect(135);
            Expect(37);
            Expr(out condition);
            Expect(22);
            Expr(out trueExpr);
            if (la.kind == 22) {
            Get();
            Expr(out falseExpr);
            }
            Expect(38);
            if(falseExpr != null)
            {
                conditionalExpression.Condition = condition;
                conditionalExpression.TrueExpression = trueExpr;
                conditionalExpression.FalseExpression = falseExpr;
                conditionalExpression.EndLocation = t.EndLocation;

                expr = conditionalExpression;
            }
            else
            {
                binaryOperatorExpression.Left = condition;
                binaryOperatorExpression.Right = trueExpr;
                binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
                binaryOperatorExpression.EndLocation = t.EndLocation;

                expr = binaryOperatorExpression;
            }
        }
コード例 #6
0
 public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
 {
     Debug.Assert((conditionalExpression != null));
     Debug.Assert((conditionalExpression.Condition != null));
     Debug.Assert((conditionalExpression.TrueExpression != null));
     Debug.Assert((conditionalExpression.FalseExpression != null));
     nodeStack.Push(conditionalExpression.Condition);
     conditionalExpression.Condition.AcceptVisitor(this, data);
     conditionalExpression.Condition = ((Expression)(nodeStack.Pop()));
     nodeStack.Push(conditionalExpression.TrueExpression);
     conditionalExpression.TrueExpression.AcceptVisitor(this, data);
     conditionalExpression.TrueExpression = ((Expression)(nodeStack.Pop()));
     nodeStack.Push(conditionalExpression.FalseExpression);
     conditionalExpression.FalseExpression.AcceptVisitor(this, data);
     conditionalExpression.FalseExpression = ((Expression)(nodeStack.Pop()));
     return null;
 }