TemplateDeclaration

Members

Functions

addInstance
TemplateInstance addInstance(TemplateInstance ti)

Add instance ti to TemplateDeclaration's table of instances. Return a handle we can use to later remove it if it fails instantiation.

declareParameter
RootObject declareParameter(Scope* sc, TemplateParameter tp, RootObject o)

Declare template parameter tp with value o, and install it in the scope sc.

deduceFunctionTemplateMatch
MATCH deduceFunctionTemplateMatch(TemplateInstance ti, Scope* sc, ref FuncDeclaration fd, Type tthis, Expressions* fargs)

Match function arguments against a specific template function. Input: ti sc instantiation scope fd tthis 'this' argument if !NULL fargs arguments to function Output: fd Partially instantiated function declaration ti.tdtypes Expression/Type deduced template arguments

doHeaderInstantiation
FuncDeclaration doHeaderInstantiation(TemplateInstance ti, Scope* sc2, FuncDeclaration fd, Type tthis, Expressions* fargs)

Limited function template instantiation for using fd.leastAsSpecialized()

evaluateConstraint
bool evaluateConstraint(TemplateInstance ti, Scope* sc, Scope* paramscope, Objects* dedargs, FuncDeclaration fd)

Check to see if constraint is satisfied.

findExistingInstance
TemplateInstance findExistingInstance(TemplateInstance tithis, Expressions* fargs)

Given a new instance tithis of this TemplateDeclaration, see if there already exists an instance. If so, return that existing instance.

isOverloadable
bool isOverloadable()

We can overload templates.

isVariadic
TemplateTupleParameter isVariadic()

Check if the last template parameter is a tuple one, and returns it if so, else returns null.

leastAsSpecialized
MATCH leastAsSpecialized(Scope* sc, TemplateDeclaration td2, Expressions* fargs)

Determine partial specialization order of 'this' vs td2.

matchWithInstance
MATCH matchWithInstance(Scope* sc, TemplateInstance ti, Objects* dedtypes, Expressions* fargs, int flag)

Given that ti is an instance of this TemplateDeclaration, deduce the types of the parameters to this, and store those deduced types in dedtypes[]. Input: flag 1: don't do semantic() because of dummy types 2: don't change types in matchArg() Output: dedtypes deduced arguments Return match level.

overloadInsert
bool overloadInsert(Dsymbol s)

Overload existing TemplateDeclaration 'this' with the new one 's'. Return true if successful; i.e. no conflict.

removeInstance
void removeInstance(TemplateInstance ti)

Remove TemplateInstance from table of instances. Input: handle returned by addInstance()

Inherited Members

From ScopeDsymbol

search
Dsymbol search(Loc loc, Identifier ident, int flags = SearchLocalsOnly)

This function is #1 on the list of functions that eat cpu time. Be very, very careful about slowing it down.

findGetMembers
FuncDeclaration findGetMembers()

Look for member of the form: const(MemberInfo)[] getMembers(string); Returns NULL if not found

hasStaticCtorOrDtor
bool hasStaticCtorOrDtor()

Return true if any of the members are static ctors or static dtors, or if any members have members that are.

dim
size_t dim(Dsymbols* members)

Determine number of Dsymbols, folding in AttribDeclaration members.

getNth
Dsymbol getNth(Dsymbols* members, size_t nth, size_t* pn = null)

Get nth Dsymbol, folding in AttribDeclaration members.

_foreach
int _foreach(Scope* sc, Dsymbols* members, scope ForeachDg dg, size_t* pn = null)

Expands attribute declarations in members in depth first order. Calls dg(size_t symidx, Dsymbol *sym) for each member. If dg returns !=0, stops and returns that value else returns 0. Use this function to avoid the O(N + N^2/2) complexity of calculating dim and calling N times getNth.

Meta