Exemplo n.º 1
0
 public CTerIfExpr(Expr left, Expr right) : base("?", left, right)
 {
     CTerElseExpr = right as CTerElseExpr;
     if (CTerElseExpr == null)
     {
         throw new ArgumentException($"Type of {nameof(right)} excepted to be {nameof(CTerElseExpr)} but is {right.GetType().FullName}");
     }
 }
Exemplo n.º 2
0
        public static Expr FormCTerExpr(Expr left, Expr right)
        {
            if (!(right is CTerElseExpr pivot && pivot.Right is CTerElseExpr pivotChild))
            {
                return(new CTerIfExpr(left, right));
            }
            var c = new CTerElseExpr(pivot.Left, pivotChild.Left);

            return(new CTerElseExpr(new CTerIfExpr(left, c), pivotChild.Right));
        }