Mercurial > projects > dil
changeset 605:9daa6c34c45a
Moved template parameter classes to dil.ast.Parameter.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Sun, 06 Jan 2008 01:09:54 +0100 |
parents | 87f09469d337 |
children | e98d659f1c29 |
files | trunk/src/dil/ast/Parameter.d trunk/src/dil/ast/Types.d |
diffstat | 2 files changed, 123 insertions(+), 119 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/dil/ast/Parameter.d Sun Jan 06 01:06:36 2008 +0100 +++ b/trunk/src/dil/ast/Parameter.d Sun Jan 06 01:09:54 2008 +0100 @@ -69,3 +69,126 @@ size_t length() { return children.length; } } + +/********************* + Template parameters: +*/ + +abstract class TemplateParameter : Node +{ + Identifier* ident; + this(Identifier* ident) + { + super(NodeCategory.Other); + this.ident = ident; + } +} + +class TemplateAliasParameter : TemplateParameter +{ + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) + { + super(ident); + mixin(set_kind); + addOptChild(specType); + addOptChild(defType); + this.ident = ident; + this.specType = specType; + this.defType = defType; + } +} + +class TemplateTypeParameter : TemplateParameter +{ + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) + { + super(ident); + mixin(set_kind); + addOptChild(specType); + addOptChild(defType); + this.ident = ident; + this.specType = specType; + this.defType = defType; + } +} + +version(D2) +{ +class TemplateThisParameter : TemplateParameter +{ + TypeNode specType, defType; + this(Identifier* ident, TypeNode specType, TypeNode defType) + { + super(ident); + mixin(set_kind); + addOptChild(specType); + addOptChild(defType); + this.ident = ident; + this.specType = specType; + this.defType = defType; + } +} +} + +class TemplateValueParameter : TemplateParameter +{ + TypeNode valueType; + Expression specValue, defValue; + this(TypeNode valueType, Identifier* ident, Expression specValue, Expression defValue) + { + super(ident); + mixin(set_kind); + addChild(valueType); + addOptChild(specValue); + addOptChild(defValue); + this.valueType = valueType; + this.ident = ident; + this.specValue = specValue; + this.defValue = defValue; + } +} + +class TemplateTupleParameter : TemplateParameter +{ + this(Identifier* ident) + { + super(ident); + mixin(set_kind); + this.ident = ident; + } +} + +class TemplateParameters : Node +{ + this() + { + super(NodeCategory.Other); + mixin(set_kind); + } + + void opCatAssign(TemplateParameter parameter) + { + addChild(parameter); + } + + TemplateParameter[] items() + { + return cast(TemplateParameter[])children; + } +} + +class TemplateArguments : Node +{ + this() + { + super(NodeCategory.Other); + mixin(set_kind); + } + + void opCatAssign(Node argument) + { + addChild(argument); + } +}
--- a/trunk/src/dil/ast/Types.d Sun Jan 06 01:06:36 2008 +0100 +++ b/trunk/src/dil/ast/Types.d Sun Jan 06 01:09:54 2008 +0100 @@ -26,125 +26,6 @@ } } -abstract class TemplateParameter : Node -{ - Identifier* ident; - this(Identifier* ident) - { - super(NodeCategory.Other); - this.ident = ident; - } -} - -class TemplateAliasParameter : TemplateParameter -{ - TypeNode specType, defType; - this(Identifier* ident, TypeNode specType, TypeNode defType) - { - super(ident); - mixin(set_kind); - addOptChild(specType); - addOptChild(defType); - this.ident = ident; - this.specType = specType; - this.defType = defType; - } -} - -class TemplateTypeParameter : TemplateParameter -{ - TypeNode specType, defType; - this(Identifier* ident, TypeNode specType, TypeNode defType) - { - super(ident); - mixin(set_kind); - addOptChild(specType); - addOptChild(defType); - this.ident = ident; - this.specType = specType; - this.defType = defType; - } -} - -version(D2) -{ -class TemplateThisParameter : TemplateParameter -{ - TypeNode specType, defType; - this(Identifier* ident, TypeNode specType, TypeNode defType) - { - super(ident); - mixin(set_kind); - addOptChild(specType); - addOptChild(defType); - this.ident = ident; - this.specType = specType; - this.defType = defType; - } -} -} - -class TemplateValueParameter : TemplateParameter -{ - TypeNode valueType; - Expression specValue, defValue; - this(TypeNode valueType, Identifier* ident, Expression specValue, Expression defValue) - { - super(ident); - mixin(set_kind); - addChild(valueType); - addOptChild(specValue); - addOptChild(defValue); - this.valueType = valueType; - this.ident = ident; - this.specValue = specValue; - this.defValue = defValue; - } -} - -class TemplateTupleParameter : TemplateParameter -{ - this(Identifier* ident) - { - super(ident); - mixin(set_kind); - this.ident = ident; - } -} - -class TemplateParameters : Node -{ - this() - { - super(NodeCategory.Other); - mixin(set_kind); - } - - void opCatAssign(TemplateParameter parameter) - { - addChild(parameter); - } - - TemplateParameter[] items() - { - return cast(TemplateParameter[])children; - } -} - -class TemplateArguments : Node -{ - this() - { - super(NodeCategory.Other); - mixin(set_kind); - } - - void opCatAssign(Node argument) - { - addChild(argument); - } -} - enum TID { Void = TOK.Void,