module volta.postparse.attribremoval
Post Parsing Passes

Code that flattens volt attributes onto ir nodes.

Code Map

//! Code that flattens volt attributes onto ir nodes.
module volta.postparse.attribremoval;


//! A pass that turns Attributes nodes into fields on to Functions, Classes
//! and the like.
class AttribRemoval : NullVisitor, Pass
{
public:
	struct ContextSink
	{
	public:
		enum MaxSize;


	public:
		alias Sink = void delegate(scope (SinkArg));
		alias SinkArg = scope (scope (T)[]);


	public:
		fn length() size_t { }
		fn sink(type: T) { }
		fn append(arr: scope (scope (T)[])) { }
		fn append(s: SinkStruct) { }
		fn popLast() T { }
		fn getLast() T { }
		fn get(i: size_t) T { }
		fn set(i: size_t, n: T) { }
		fn setLast(i: T) { }
		fn toSink(sink: Sink) { }
		fn toArray() T[] { }
		fn borrowUnsafe() T[] { }
		fn reset() { }
	}


public:
	target: TargetInfo;
	errSink: ErrorSink;


public:
	this(target: TargetInfo, errSink: ErrorSink) { }
	fn transform(m: ir.Module) { }
	fn transform(m: ir.Module, func: ir.Function, bs: ir.BlockStatement) { }
	fn close() { }
	fn enter(m: ir.Module) Status { }
	fn enter(tlb: ir.TopLevelBlock) Status { }
	fn enter(i: ir.Import) Status { }
	fn enter(func: ir.Function) Status { }
	fn enter(d: ir.Variable) Status { }
	fn enter(ed: ir.EnumDeclaration) Status { }
	fn enter(s: ir.Struct) Status { }
	fn enter(u: ir.Union) Status { }
	fn enter(c: ir.Class) Status { }
	fn enter(i: ir._Interface) Status { }
	fn enter(e: ir.Enum) Status { }
	fn enter(a: ir.Alias) Status { }
	fn leave(func: ir.Function) Status { }
	fn leave(s: ir.Struct) Status { }
	fn leave(u: ir.Union) Status { }
	fn leave(c: ir.Class) Status { }
	fn leave(i: ir._Interface) Status { }
	fn leave(m: ir.Module) Status { }
	fn enter(attr: ir.Attribute) Status { }
	fn leave(attr: ir.Attribute) Status { }
	fn visit(td: ir.TemplateDefinition) Status { }


protected:
	//! Helper class.
	class Context
	{
	public:
		node: ir.Node;
		stack: AttributeSink;
		oldStack: AttributeSink;


	public:
		this(node: ir.Node) { }
	}


protected:
	mCtxStack: ContextSink;
	mAttrStack: AttributeSink;


protected:
	fn ctxTop() Context { }
	fn ctxPush(node: ir.Node, inherit: bool) { }
	fn ctxPop(node: ir.Node) { }
	fn attrTop() ir.Attribute { }
	fn attrPush(attr: ir.Attribute) { }
	fn attrPop(attr: ir.Attribute) { }
	fn attrPushDown() { }
	fn manipAttr(ns: NodeSink, attr: ir.Attribute) { }
	fn manip(nodes: ir.Node[]) ir.Node[] { }
	fn manip(ns: NodeSink, nodes: ir.Node[]) { }
	fn manip(ns: NodeSink, n: ir.Node) { }
}

//! Loops over all attributes and applies them.
fn applyAttributes(i: ir.Import, attrs: AttributeSink, errSink: ErrorSink) { }
//! Loops over all attributes and applies them.
fn applyAttributes(func: ir.Function, attrs: AttributeSink, errSink: ErrorSink, target: TargetInfo) { }
//! Loops over all attributes and applies them.
fn applyAttributes(ed: ir.EnumDeclaration, attrs: AttributeSink, errSink: ErrorSink) { }
//! Loops over all attributes and applies them.
fn applyAttributes(d: ir.Variable, attrs: AttributeSink, errSink: ErrorSink, target: TargetInfo) { }
//! Loops over all attributes and applies them.
fn applyAttributes(s: ir.Aggregate, attrs: AttributeSink, errSink: ErrorSink) { }
//! Loops over all attributes and applies them.
fn applyAttributes(i: ir._Interface, attrs: AttributeSink, errSink: ErrorSink) { }
//! Loops over all attributes and applies them.
fn applyAttributes(e: ir.Enum, attrs: AttributeSink, errSink: ErrorSink) { }
//! Loops over all attributes and applies them.
fn applyAttributes(a: ir.Alias, attrs: AttributeSink, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(i: ir.Import, attr: ir.Attribute, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(func: ir.Function, attr: ir.Attribute, errSink: ErrorSink, target: TargetInfo) { }
//! Applies a single attribute.
fn applyAttribute(ed: ir.EnumDeclaration, attr: ir.Attribute, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(d: ir.Variable, attr: ir.Attribute, errSink: ErrorSink, target: TargetInfo) { }
//! Applies a single attribute.
fn applyAttribute(s: ir.Aggregate, attr: ir.Attribute, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(i: ir._Interface, attr: ir.Attribute, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(e: ir.Enum, attr: ir.Attribute, errSink: ErrorSink) { }
//! Applies a single attribute.
fn applyAttribute(a: ir.Alias, attr: ir.Attribute, errSink: ErrorSink) { }
fn applyAttributes(i: ir.Import, attrs: AttributeSink, errSink: ErrorSink)

Loops over all attributes and applies them.

fn applyAttribute(i: ir.Import, attr: ir.Attribute, errSink: ErrorSink)

Applies a single attribute.

class AttribRemoval : NullVisitor, Pass

A pass that turns Attributes nodes into fields on to Functions, Classes and the like.

class Context

Helper class.