Mercurial > projects > dil
changeset 281:c1fcfbce9499
- BaseClass inherits from Node now.
- Added types to enum NodeKind.
- Added other class names to enum NodeKind.
- Added mixin(set_kind) statement to every constructor that inherits from Type or Node.
author | aziz |
---|---|
date | Mon, 06 Aug 2007 19:23:03 +0000 |
parents | 1eb54f6f392e |
children | 74113a9aa77c |
files | trunk/src/SyntaxTree.d trunk/src/Types.d |
diffstat | 2 files changed, 42 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/SyntaxTree.d Mon Aug 06 18:54:01 2007 +0000 +++ b/trunk/src/SyntaxTree.d Mon Aug 06 19:23:03 2007 +0000 @@ -172,11 +172,31 @@ ArrayInitializer, StructInitializer, - // Miscellaneous: + // Types: + IntegralType, + UndefinedType, + DotListType, + IdentifierType, + TypeofType, + TemplateInstanceType, + PointerType, + ArrayType, + FunctionType, + DelegateType, + ConstType, // D2.0 + InvariantType, // D2.0 + + // Other: FunctionBody, + Parameter, + Parameters, + BaseClass, + TemplateParameter, + TemplateParameters, + TemplateArguments, } -/// This string is mixed in into the constructor of a class that inherits from Node. +/// This string is mixed into the constructor of a class that inherits from Node. const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`; class Node
--- a/trunk/src/Types.d Mon Aug 06 18:54:01 2007 +0000 +++ b/trunk/src/Types.d Mon Aug 06 19:23:03 2007 +0000 @@ -50,6 +50,7 @@ this(Token* stcTok, Type type, Token* ident, Expression assignExpr) { super(NodeCategory.Other); + mixin(set_kind); StorageClass stc; if (stcTok !is null) @@ -94,6 +95,7 @@ this() { super(NodeCategory.Other); + mixin(set_kind); } bool hasVariadic() @@ -121,12 +123,14 @@ Export = 1<<4 } -class BaseClass +class BaseClass : Node { Protection prot; Type type; this(Protection prot, Type type) { + super(NodeCategory.Other); + mixin(set_kind); this.prot = prot; this.type = type; } @@ -150,6 +154,7 @@ this(TP tp, Type valueType, Token* ident, Type specType, Type defType, Expression specValue, Expression defValue) { super(NodeCategory.Other); + mixin(set_kind); this.tp = tp; this.valueType = valueType; this.ident = ident; @@ -167,6 +172,7 @@ this() { super(NodeCategory.Other); + mixin(set_kind); } void opCatAssign(TemplateParameter parameter) @@ -182,6 +188,7 @@ this() { super(NodeCategory.Other); + mixin(set_kind); } void opCatAssign(Node argument) @@ -251,6 +258,7 @@ this(TOK tok) { super(cast(TID)tok); + mixin(set_kind); } } @@ -259,6 +267,7 @@ this() { super(TID.Undefined); + mixin(set_kind); } } @@ -268,6 +277,7 @@ this(Type[] dotList) { super(TID.DotList); + mixin(set_kind); this.dotList = dotList; } } @@ -278,6 +288,7 @@ this(Token* ident) { super(TID.Identifier); + mixin(set_kind); this.ident = ident; } } @@ -288,6 +299,7 @@ this(Expression e) { super(TID.Typeof); + mixin(set_kind); this.e = e; } } @@ -299,6 +311,7 @@ this(Token* ident, TemplateArguments targs) { super(TID.TemplateInstance); + mixin(set_kind); this.ident = ident; this.targs = targs; } @@ -309,6 +322,7 @@ this(Type t) { super(TID.Pointer, t); + mixin(set_kind); } } @@ -319,6 +333,7 @@ this(Type t) { super(TID.Array, t); + mixin(set_kind); } this(Type t, Expression e, Expression e2) { @@ -341,6 +356,7 @@ this(Type returnType, Parameters parameters, TemplateParameters tparams = null) { super(TID.Function); + mixin(set_kind); this.returnType = returnType; this.parameters = parameters; this.tparams = tparams; @@ -352,6 +368,7 @@ this(Type func) { super(TID.Delegate, func); + mixin(set_kind); } } @@ -363,6 +380,7 @@ { // If t is null: cast(const) super(TID.Const, t); + mixin(set_kind); } } @@ -372,6 +390,7 @@ { // If t is null: cast(invariant) super(TID.Invariant, t); + mixin(set_kind); } } } // version(D2)