Mercurial > projects > dil
diff trunk/src/Types.d @ 135:145e0d68ec95
- Added enum TID to module Type.
- Classes that inherit from Type are passing correct TID to its ctor.
author | aziz |
---|---|
date | Tue, 10 Jul 2007 22:23:02 +0000 |
parents | a31aa0d6dd5e |
children | b49903801f14 |
line wrap: on
line diff
--- a/trunk/src/Types.d Tue Jul 10 21:20:05 2007 +0000 +++ b/trunk/src/Types.d Tue Jul 10 22:23:02 2007 +0000 @@ -71,17 +71,57 @@ { return items.length; } } +enum TID +{ + Void = TOK.Void, + Char = TOK.Char, + Wchar = TOK.Wchar, + Dchar = TOK.Dchar, + Bool = TOK.Bool, + Byte = TOK.Byte, + Ubyte = TOK.Ubyte, + Short = TOK.Short, + Ushort = TOK.Ushort, + Int = TOK.Int, + Uint = TOK.Uint, + Long = TOK.Long, + Ulong = TOK.Ulong, + Float = TOK.Float, + Double = TOK.Double, + Real = TOK.Real, + Ifloat = TOK.Ifloat, + Idouble = TOK.Idouble, + Ireal = TOK.Ireal, + Cfloat = TOK.Cfloat, + Cdouble = TOK.Cdouble, + Creal = TOK.Creal, + + Undefined, + Function, + Delegate, + Pointer, + Array, + Identifier, + Typeof, + Specialization, +} + class Type { - TOK type; + TID tid; Type next; - this(TOK type) - { this(type, null); } + this(TOK tok) + { + this.tid = cast(TID)tok; + } - this(TOK type, Type next) + this(TID tid) + { this(tid, null); } + + this(TID tid, Type next) { - this.type = type; + this.tid = tid; this.next = next; } } @@ -90,7 +130,7 @@ { this() { - super(TOK.Invalid, null); + super(TID.Undefined, null); } } @@ -100,13 +140,13 @@ this(string[] idents) { - super(TOK.Identifier, null); + super(TID.Identifier, null); this.idents = idents; } - this(TOK type) + this(TID tid) { - super(type, null); + super(tid); } void opCatAssign(string ident) @@ -120,7 +160,7 @@ Expression e; this(Expression e) { - super(TOK.Typeof); + super(TID.Typeof); this.e = e; } } @@ -129,7 +169,7 @@ { this(Type t) { - super(TOK.Mul, t); + super(TID.Pointer, t); } } @@ -139,7 +179,7 @@ Type assocType; this(Type t) { - super(TOK.Invalid, t); + super(TID.Array, t); } this(Type t, Expression e, Expression e2) { @@ -163,14 +203,14 @@ this(TOK specTok, TOK tokType) { - super(TOK.Invalid, null); + super(TID.Specialization, null); this.specTok = specTok; this.tokType = tokType; } this(TOK specTok, Type type) { - super(TOK.Invalid, null); + super(TID.Specialization, null); this.specTok = specTok; this.type = type; } @@ -182,8 +222,16 @@ Parameters parameters; this(Type returnType, Parameters parameters) { - super(TOK.Invalid, null); + super(TID.Function, null); this.returnType = returnType; this.parameters = parameters; } } + +class DelegateType : Type +{ + this(Type func) + { + super(TID.Delegate, func); + } +}