コード例 #1
0
        protected internal override MAst Transform()
        {
            MAst left  = Left.Transform();
            MAst right = Right.Transform();

            switch (Operator)
            {
            case TigerOperator.Add:
                return(MAst.Add(left, right));

            case TigerOperator.Subtract:
                return(MAst.Subtract(left, right));

            case TigerOperator.Multiply:
                return(MAst.Multiply(left, right));

            case TigerOperator.Divide:
                return(MAst.Divide(left, right));

            case TigerOperator.Mod:
                return(MAst.Modulo(left, right));

            case TigerOperator.Power:
                // todo handle doubles in operations
                return
                    (MAst.Convert(
                         MAst.Power(MAst.Convert(left, typeof(double)), MAst.Convert(right, typeof(double))),
                         typeof(int)));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
        protected internal override MAst Transform()
        {
            MAst left  = Left.Transform();
            MAst right = Right.Transform();

            switch (Operator)
            {
            case TigerOperator.AndAlso:
                return(MAst.AndAlso(left, right));

            case TigerOperator.OrElse:
                return(MAst.OrElse(left, right));

            case TigerOperator.ExclusiveOr:
                return(MAst.ExclusiveOr(left, right));

            case TigerOperator.LessThan:
                return(MAst.LessThan(left, right));

            case TigerOperator.LessThanOrEqual:
                return(MAst.LessThanOrEqual(left, right));

            case TigerOperator.GreaterThan:
                return(MAst.GreaterThan(left, right));

            case TigerOperator.GreaterThanOrEqual:
                return(MAst.GreaterThanOrEqual(left, right));

            case TigerOperator.Equal:
                return(MAst.Invoke(EqualsExpression, left.Convert <object>(), right.Convert <object>()));

            case TigerOperator.NotEqual:
                return(MAst.Invoke(NotEqualsExpression, left.Convert <object>(), right.Convert <object>()));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #3
0
 protected internal override MAst Transform()
 {
     return(MAst.Convert(Expression.Transform(), Type));
 }