Mercurial > projects > dil
diff trunk/src/Types.d @ 269:a416e09c08ea
- Implemented D 2.0 additions.
- Added keyword __traits, TOK.Traits and TraitsExpression.
- Added ForeachRangeStatement, ConstType and InvariantType.
- Fix: avoid infinite loop by calling nT() to skip storage class.
- Fix: don't call nT() in parseVersionDeclaration.parseIdentOrInt().
author | aziz |
---|---|
date | Sat, 04 Aug 2007 18:59:04 +0000 |
parents | 50cc74026ea8 |
children | e8de572e4d01 |
line wrap: on
line diff
--- a/trunk/src/Types.d Sat Aug 04 13:23:01 2007 +0000 +++ b/trunk/src/Types.d Sat Aug 04 18:59:04 2007 +0000 @@ -224,6 +224,8 @@ Identifier, Typeof, TemplateInstance, + Const, // D2 + Invariant, // D2 } class Type : Node @@ -267,34 +269,6 @@ } } -/+ -class IdentifierType : Type -{ - string[] idents; - - this(string[] idents) - { - super(TID.Identifier, null); - this.idents = idents; - } - - this(string ident) - { - super(TID.Identifier, null); - } - - this(TID tid) - { - super(tid); - } - - void opCatAssign(string ident) - { - this.idents ~= ident; - } -} -+/ - class IdentifierType : Type { Token* ident; @@ -304,17 +278,6 @@ this.ident = ident; } } -/+ -class TypeofType : IdentifierType -{ - Expression e; - this(Expression e) - { - super(TID.Typeof); - this.e = e; - } -} -+/ class TypeofType : Type { @@ -388,3 +351,24 @@ super(TID.Delegate, func); } } + +version(D2) +{ +class ConstType : Type +{ + this(Type t) + { + // If t is null: cast(const) + super(TID.Const, t); + } +} + +class InvariantType : Type +{ + this(Type t) + { + // If t is null: cast(invariant) + super(TID.Invariant, t); + } +} +} // version(D2)