module core.typeinfo

Code Map

module core.typeinfo;


//! The types of Volt, the type field of TypeInfo.
enum Type
{
	Struct,
	Class,
	Interface,
	Union,
	Enum,
	Attribute,
	Void,
	U8,
	I8,
	Char,
	Bool,
	U16,
	I16,
	Wchar,
	U32,
	I32,
	Dchar,
	F32,
	U64,
	I64,
	F64,
	Real,
	Pointer,
	Array,
	StaticArray,
	AA,
	Function,
	Delegate,
}

//! Information for a type that can be retrieved at runtime.
class TypeInfo
{
public:
	//! The size of the type, in bytes.
	size: size_t;
	//! The specific type. A member of the Type enum.
	type: i32;
	//! The Volt mangled name (if any)
	mangledName: char[];
	//! Can this type mutate memory?
	mutableIndirection: bool;
	//! The class init struct, if this points at a class.
	classInit: void*;
	//! The size of the class, if this points at a class.
	classSize: size_t;
	//! The base type for arrays (dynamic and static), and pointers.
	base: TypeInfo;
	//! If this points at a static array, how long is it?
	staticArrayLength: size_t;
	key: TypeInfo;
	//! The key and value types for AAs.
	value: TypeInfo;
	//! For functions and delegates, what's the return type?
	ret: TypeInfo;
	//! For functions and delegates, what are the parameter types?
	args: TypeInfo[];


public:
	this() { }
}

//! A TypeInfo used by classes.
class ClassInfo : TypeInfo
{
public:
	//! The interfaces the class this refers to implements.
	interfaces: InterfaceInfo[];


public:
	this() { }
}

//! Type information for interfaces.
class InterfaceInfo
{
public:
	//! The tinfo for the pointed at interface.
	info: TypeInfo;
	//! How many bytes after the vtable does the information for this
	//! interface lie?
	offset: size_t;


public:
	this() { }
}
enum Type

The types of Volt, the type field of TypeInfo.

class TypeInfo

Information for a type that can be retrieved at runtime.

This is the object that the typeid expression returns.

size: size_t

The size of the type, in bytes.

type: i32

The specific type. A member of the Type enum.

mangledName: char[]

The Volt mangled name (if any)

mutableIndirection: bool

Can this type mutate memory?

classInit: void*

The class init struct, if this points at a class.

classSize: size_t

The size of the class, if this points at a class.

base: TypeInfo

The base type for arrays (dynamic and static), and pointers.

staticArrayLength: size_t

If this points at a static array, how long is it?

value: TypeInfo

The key and value types for AAs.

ret: TypeInfo

For functions and delegates, what's the return type?

args: TypeInfo[]

For functions and delegates, what are the parameter types?

class ClassInfo : TypeInfo

A TypeInfo used by classes.

interfaces: InterfaceInfo[]

The interfaces the class this refers to implements.

class InterfaceInfo

Type information for interfaces.

info: TypeInfo

The tinfo for the pointed at interface.

offset: size_t

How many bytes after the vtable does the information for this interface lie?