C-minor v0.0

OperatorEvaluation Class

Assembly: Topten.Cminor.Compiler.dll
Namespace: Topten.Cminor

A set of static helper methods for performing arthimetic and logical operations on untyped "objects".

public static class OperatorEvaluation

Methods

Add(object, object)

Arithmetic Add

BitwiseAnd(object, object)

Bitwise And

BitwiseNot(object)

Bitwise Not

BitwiseOr(object, object)

Bitwise Or

BitwiseXor(object, object)

Bitwise Xor

Compare(object, object)

Arithmetic Comparison

Compare(object, object, string)

Arithmetic Comparison

CompareEQ(object, object)

Compare two values for Equality

CompareGE(object, object)

Compare two values for Greater Than or Equal

CompareGT(object, object)

Compare two values for Greater Than

CompareLE(object, object)

Compare two values for Less Than or Equal

CompareLT(object, object)

Compare two values for Less Than

CompareNE(object, object)

Compare two values for Inequality

Divide(object, object)

Arithmetic Divide

Evaluate(UnaryOperatorType, object)

Evaluate a unary operation

Evaluate(BinaryOperatorType, object, object)

Evaluate a binary operation

ExplicitCast(object, Type)

Explicitlyl cast a value to another

GetInvertedComparisonOp(BinaryOperatorType)
GetResultType(UnaryOperatorType, Type)

Give an operator and two operand types, work out the result type

GetResultType(BinaryOperatorType, Type, Type)

Give an operator and two operand types, work out the result type

GetSymbol(BinaryOperatorType)
GetSymbol(UnaryOperatorType)
ImplicitCast(object, Type)

Tries to implicitly convert a type, thowing an exception if it doesn't fit in the target type, or there's loss of precision when casting from floating point types

IsExplicitlyConvertible(Type, Type)

Check if a source type is explicitly castable to another type

IsImplicitlyConvertible(Type, Type)

Check if a type can be implicitly converted to another type

LogicalAnd(object, object)

Logical And (not short-circuiting)

LogicalNot(object)

Logical Not

LogicalOr(object, object)

Logical Or (not short-circuiting)

Modulus(object, object)

Arithmetic Modulus

Multiply(object, object)

Arithmetic Multiply

Negate(object)

Arithmetic Negate

ShiftLeft(object, object)

Bit Shift Left

ShiftRight(object, object)

Bit Shift Right

Subtract(object, object)

Arithmetic Subtract

SubtractReverse(object, object)

Arithmetic Subtract

TryGetResultType(UnaryOperatorType, Type)

Give an operator and two operand types, work out the result type

TryGetResultType(BinaryOperatorType, Type, Type)

Give an operator and two operand types, work out the result type