comparison trunk/src/dil/TypeSystem.d @ 526:ee22dc0ba82c

Added more Type classes to dil.TypeSystem.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 16 Dec 2007 22:12:44 +0100
parents a3f66502ea64
children c8c3aec130f7
comparison
equal deleted inserted replaced
525:a3f66502ea64 526:ee22dc0ba82c
5 module dil.TypeSystem; 5 module dil.TypeSystem;
6 6
7 import dil.Symbol; 7 import dil.Symbol;
8 import dil.TypesEnum; 8 import dil.TypesEnum;
9 import dil.CompilerInfo; 9 import dil.CompilerInfo;
10 import dil.Identifier;
10 11
11 abstract class Type : Symbol 12 abstract class Type : Symbol
12 { 13 {
13 Type next; 14 Type next;
14 TYP typ; 15 TYP typ;
35 } 36 }
36 } 37 }
37 38
38 class TypeDArray : Type 39 class TypeDArray : Type
39 { 40 {
40 41 this(Type next)
42 {
43 super(next, TYP.DArray);
44 }
41 } 45 }
42 46
43 class TypeAArray : Type 47 class TypeAArray : Type
44 { 48 {
45 49 Type keyType;
50 this(Type next, Type keyType)
51 {
52 super(next, TYP.AArray);
53 this.keyType = keyType;
54 }
46 } 55 }
47 56
48 class TypeSArray : Type 57 class TypeSArray : Type
49 { 58 {
50 59 size_t dimension;
60 this(Type next, size_t dimension)
61 {
62 super(next, TYP.SArray);
63 this.dimension = dimension;
64 }
51 } 65 }
52 66
53 class TypePointer : Type 67 class TypePointer : Type
54 { 68 {
55 this(Type next) 69 this(Type next)
58 } 72 }
59 } 73 }
60 74
61 class TypeReference : Type 75 class TypeReference : Type
62 { 76 {
63 77 this(Type next)
78 {
79 super(next, TYP.Reference);
80 }
81 }
82
83 class EnumType : Type
84 {
85 this(Type baseType)
86 {
87 super(baseType, TYP.Enum);
88 }
89
90 Type baseType()
91 {
92 return next;
93 }
94 }
95
96 class StructType : Type
97 {
98 this()
99 {
100 super(null, TYP.Struct);
101 }
102 }
103
104 class ClassType : Type
105 {
106 this()
107 {
108 super(null, TYP.Class);
109 }
110 }
111
112 class TypedefType : Type
113 {
114 this(Type next)
115 {
116 super(next, TYP.Typedef);
117 }
118 }
119
120 class FunctionType : Type
121 {
122 this(Type next)
123 {
124 super(next, TYP.Function);
125 }
126 }
127
128 class DelegateType : Type
129 {
130 this(Type next)
131 {
132 super(next, TYP.Delegate);
133 }
134 }
135
136 class IdentifierType : Type
137 {
138 Identifier* ident;
139 this(Identifier* ident)
140 {
141 super(null, TYP.Identifier);
142 }
143 }
144
145 class TInstanceType : Type
146 {
147 this()
148 {
149 super(null, TYP.TInstance);
150 }
151 }
152
153 class TupleType : Type
154 {
155 this(Type next)
156 {
157 super(next, TYP.Tuple);
158 }
159 }
160
161 class ConstType : Type
162 {
163 this(Type next)
164 {
165 super(next, TYP.Const);
166 }
167 }
168
169 class InvariantType : Type
170 {
171 this(Type next)
172 {
173 super(next, TYP.Const);
174 }
64 } 175 }
65 176
66 struct TypeMetaInfo 177 struct TypeMetaInfo
67 { 178 {
68 char mangle; /// Mangle character of the type. 179 char mangle; /// Mangle character of the type.