示例#1
0
 public PyTerExprIf(Expr left, Expr right) : base(" _pyif_ ", left, right)
 {
     PyTerExprElse = right as PyTerExprElse;
     if (PyTerExprElse == null)
     {
         throw new ArgumentException($"Type of {nameof(right)} excepted to be {nameof(PyTerExprElse)} but is {right.GetType().FullName}");
     }
 }
示例#2
0
        public static Expr FormPyTerExpr(Expr left, Expr right)
        {
            if (!(right is PyTerExprElse pivot && pivot.Right is PyTerExprElse pivotChild))
            {
                return(new PyTerExprIf(left, right));
            }
            var c = new PyTerExprElse(pivot.Left, pivotChild.Left);

            return(new PyTerExprElse(new PyTerExprIf(left, c), pivotChild.Right));
        }