Boo.Lang.Compiler.Steps.ConstantFolding.GetFoldedDoubleLiteral C# (CSharp) Метод

GetFoldedDoubleLiteral() статический приватный Метод

static private GetFoldedDoubleLiteral ( BinaryOperatorType @operator, double lhs, double rhs ) : LiteralExpression
@operator BinaryOperatorType
lhs double
rhs double
Результат Boo.Lang.Compiler.Ast.LiteralExpression
        static LiteralExpression GetFoldedDoubleLiteral(BinaryOperatorType @operator, double lhs, double rhs)
        {
            double result;

            switch (@operator)
            {
                //arithmetic
                case BinaryOperatorType.Addition:
                    result = lhs + rhs;
                    break;
                case BinaryOperatorType.Subtraction:
                    result = lhs - rhs;
                    break;
                case BinaryOperatorType.Multiply:
                    result = lhs * rhs;
                    break;
                case BinaryOperatorType.Division:
                    result = lhs / rhs;
                    break;
                case BinaryOperatorType.Modulus:
                    result = lhs % rhs;
                    break;
                case BinaryOperatorType.Exponentiation:
                    result = Math.Pow(lhs, rhs);
                    break;

                //comparison
                case BinaryOperatorType.LessThan:
                    return new BoolLiteralExpression(lhs < rhs);
                case BinaryOperatorType.LessThanOrEqual:
                    return new BoolLiteralExpression(lhs <= rhs);
                case BinaryOperatorType.GreaterThan:
                    return new BoolLiteralExpression(lhs > rhs);
                case BinaryOperatorType.GreaterThanOrEqual:
                    return new BoolLiteralExpression(lhs >= rhs);
                case BinaryOperatorType.Equality:
                    return new BoolLiteralExpression(lhs == rhs);
                case BinaryOperatorType.Inequality:
                    return new BoolLiteralExpression(lhs != rhs);

                default:
                    return null; //not supported
            }
            return new DoubleLiteralExpression(result);
        }

Same methods

ConstantFolding::GetFoldedDoubleLiteral ( UnaryOperatorType @operator, double operand ) : LiteralExpression