module volta.ir.templates

Code Map

module volta.ir.templates;


enum TemplateKind
{
	Struct,
	Class,
	Union,
	Interface,
	Function,
}

//! Creates a concrete instance of a template.
class TemplateInstance : Node
{
public:
	kind: TemplateKind;
	definitionName: QualifiedName;
	instanceName: string;
	explicitMixin: bool;
	arguments: Node[];
	names: string[];
	myScope: Scope;
	oldParent: Scope;
	_struct: Struct;
	_function: Function;
	_class: Class;
	_union: Union;
	_interface: _Interface;


public:
	this() { }
	this(old: TemplateInstance) { }
}

class TemplateDefinition : Node
{
public:
	struct Parameter
	{
	public:
		type: Type;
		name: string;
	}


public:
	kind: TemplateKind;
	name: string;
	parameters: Parameter[];
	//! Filled in by the gatherer.
	typeReferences: TypeReference[];
	//! Filled in by the gatherer.
	myScope: Scope;
	//! Only one of these fields will be non-null, depending on kind.
	_struct: Struct;
	//! Only one of these fields will be non-null, depending on kind.
	_union: Union;
	//! Only one of these fields will be non-null, depending on kind.
	_interface: _Interface;
	//! Only one of these fields will be non-null, depending on kind.
	_class: Class;
	//! Only one of these fields will be non-null, depending on kind.
	_function: Function;


public:
	this() { }
	this(old: TemplateDefinition) { }
}
class TemplateInstance : Node

Creates a concrete instance of a template.

Example: struct Foo = Bari32 fn Foo = Bar(size_t*, i16)