A Type is used in various places to qualify an entity, for example
it can hold the underlying type of a Field
or Local, or the return type or Param types for MethodSignatures.
enum BasicType {
///** type is a reference to a class
cls,
///** type is a reference to a method signature
method,
/* below this is various CIL types*/
Void, Bool, Char, i8, u8, i16, u16, i32, u32, i64, u64, inative,
unative, r32, r64, object, string
};
Closely related to Type is BoxedType,
which represents the boxed version of basic CIL types.
A type may be constructed either directly or through an Allocator object. Choose one
of several constructors depending on the type being
constructed. Additionally, a qualifying function may
have to be called for example if the type is an array type.
Constructor for a basic type, e.g. integers, floats, strings, and
the base object type.
Type(BasicType Tp, int
PointerLevel) ;
Constructor for a value of type Class
Type(DataContainer
*clsref) ;
Constructor for a method pointer
Type(MethodSignature
*methodref) ;
Access the basic type
enum BasicType
GetBasicType() const { return tp_; }
void
SetBasicType(BasicType type) { tp_ = type; }
Access extended types
DataContainer
*GetClass() const { return typeRef_; }
MethodSignature
*GetMethod() const { return methodRef_; }
Access the array rank (note - arrays of > 1 dimension require
use of CIL intrinsics that aren't directly supported by
DotNetPELib.... occil implements them as an addon
though)
void ArrayLevel(int
arrayLevel) { arrayLevel_ = arrayLevel; }
int ArrayLevel()
const { return arrayLevel_; }
Access the number of pointer qualifers
void PointerLevel(int
n) { pointerLevel_ = n; }
int PointerLevel()
const { return pointerLevel_; }
Access the ByRef flag.
void ByRef(bool val) {
byRef_ = val; }
bool ByRef() {
return byRef_; }