view dmd/TemplateParameter.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents 10317f0c89a5
children 3a0b150c9841
line wrap: on
line source

module dmd.TemplateParameter;

import dmd.Loc;
import dmd.Identifier;
import dmd.Declaration;
import dmd.TemplateTypeParameter;
import dmd.TemplateValueParameter;
import dmd.TemplateAliasParameter;
import dmd.TemplateThisParameter;
import dmd.TemplateTupleParameter;
import dmd.Scope;
import dmd.OutBuffer;
import dmd.HdrGenState;
import dmd.MATCH;
import dmd.ArrayTypes;

class TemplateParameter
{
    /* For type-parameter:
     *	template Foo(ident)		// specType is set to NULL
     *	template Foo(ident : specType)
     * For value-parameter:
     *	template Foo(valType ident)	// specValue is set to NULL
     *	template Foo(valType ident : specValue)
     * For alias-parameter:
     *	template Foo(alias ident)
     * For this-parameter:
     *	template Foo(this ident)
     */

    Loc loc;
    Identifier ident;

    Declaration sparam;

    this(Loc loc, Identifier ident)
	{
		this.loc = loc;
		this.ident = ident;
	}

    TemplateTypeParameter isTemplateTypeParameter()
	{
		return null;
	}
	
    TemplateValueParameter isTemplateValueParameter()
	{
		return null; 
	}
	
    TemplateAliasParameter isTemplateAliasParameter()
	{
		return null; 
	}
	
version (DMDV2) {
    TemplateThisParameter isTemplateThisParameter()
	{
		return null; 
	}
}
    TemplateTupleParameter isTemplateTupleParameter()
	{
		return null;
	}

    abstract TemplateParameter syntaxCopy();
    abstract void declareParameter(Scope sc);
    abstract void semantic(Scope);
    abstract void print(Object oarg, Object oded);
    abstract void toCBuffer(OutBuffer buf, HdrGenState* hgs);
    abstract Object specialization();
    abstract Object defaultArg(Loc loc, Scope sc);

    /* If TemplateParameter's match as far as overloading goes.
     */
    abstract bool overloadMatch(TemplateParameter);

    /* Match actual argument against parameter.
     */
    abstract MATCH matchArg(Scope sc, Objects tiargs, int i, TemplateParameters parameters, Objects dedtypes, Declaration* psparam, int flags = 0);

    /* Create dummy argument based on parameter.
     */
    abstract void* dummyArg();
}