Mercurial > projects > dil
annotate trunk/src/Types.d @ 249:32d354584b28
- Upgraded license notices to GPL3.
author | aziz |
---|---|
date | Wed, 01 Aug 2007 15:14:05 +0000 |
parents | 63a15b082c0c |
children | 4279b638c63e |
rev | line source |
---|---|
94 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
94 | 4 +/ |
5 module Types; | |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
6 import SyntaxTree; |
94 | 7 import Token; |
8 import Expressions; | |
9 | |
159 | 10 enum Linkage |
11 { | |
12 Invalid, | |
13 C, | |
14 Cpp, | |
15 D, | |
16 Windows, | |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
17 Pascal, |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
18 System |
159 | 19 } |
20 | |
95 | 21 enum StorageClass |
22 { | |
23 None = 0, | |
24 Abstract = 1, | |
25 Auto = 1<<2, | |
26 Const = 1<<3, | |
27 Deprecated = 1<<4, | |
28 Extern = 1<<5, | |
29 Final = 1<<6, | |
30 Invariant = 1<<7, | |
31 Override = 1<<8, | |
32 Scope = 1<<9, | |
33 Static = 1<<10, | |
34 Synchronized = 1<<11, | |
35 In = 1<<12, | |
36 Out = 1<<13, | |
37 Ref = 1<<14, | |
38 Lazy = 1<<15, | |
39 Variadic = 1<<16, | |
40 } | |
41 | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
42 class Parameter : Node |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
43 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
44 StorageClass stc; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
45 Token* stcTok; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
46 Type type; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
47 string ident; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
48 Expression assignExpr; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
49 |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
50 this(Token* stcTok, Type type, string ident, Expression assignExpr) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
51 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
52 super(NodeType.Other); |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
53 |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
54 StorageClass stc; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
55 if (stcTok !is null) |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
56 { |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
57 // NB: In D 2.0 StorageClass.In means final/scope/const |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
58 switch (stcTok.type) |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
59 { |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
60 // TODO: D 2.0 invariant/const/final/scope |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
61 case TOK.In: stc = StorageClass.In; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
62 case TOK.Out: stc = StorageClass.Out; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
63 case TOK.Inout: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
64 case TOK.Ref: stc = StorageClass.Ref; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
65 case TOK.Lazy: stc = StorageClass.Lazy; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
66 case TOK.Ellipses: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
67 stc = StorageClass.Variadic; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
68 default: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
69 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
70 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
71 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
72 this.stc = stc; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
73 this.stcTok = stcTok; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
74 this.type = type; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
75 this.ident = ident; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
76 this.assignExpr = assignExpr; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
77 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
78 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
79 bool isVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
80 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
81 return !!(stc & StorageClass.Variadic); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
82 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
83 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
84 bool isOnlyVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
85 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
86 return stc == StorageClass.Variadic; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
87 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
88 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
89 |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
90 class Parameters : Node |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
91 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
92 Parameter[] items; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
93 |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
94 this() |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
95 { |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
96 super(NodeType.Other); |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
97 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
98 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
99 bool hasVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
100 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
101 if (items.length != 0) |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
102 return items[$-1].isVariadic(); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
103 return false; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
104 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
105 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
106 void opCatAssign(Parameter param) |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
107 { items ~= param; } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
108 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
109 size_t length() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
110 { return items.length; } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
111 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
112 |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
113 |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
114 enum Protection |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
115 { |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
116 None, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
117 Private = 1, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
118 Protected = 1<<1, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
119 Package = 1<<2, |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
120 Public = 1<<3, |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
121 Export = 1<<4 |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
122 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
123 |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
124 class BaseClass |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
125 { |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
126 Protection prot; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
127 Type type; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
128 this(Protection prot, Type type) |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
129 { |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
130 this.prot = prot; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
131 this.type = type; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
132 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
133 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
134 |
137 | 135 enum TP |
136 { | |
137 Type, | |
138 Value, | |
139 Alias, | |
140 Tuple | |
141 } | |
142 | |
143 class TemplateParameter | |
144 { | |
145 TP tp; | |
146 Type valueType; | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
147 string ident; |
137 | 148 Type specType, defType; |
149 Expression specValue, defValue; | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
150 this(TP tp, Type valueType, string ident, Type specType, Type defType, Expression specValue, Expression defValue) |
137 | 151 { |
152 this.tp = tp; | |
153 this.valueType = valueType; | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
154 this.ident = ident; |
137 | 155 this.specType = specType; |
156 this.defType = defType; | |
157 this.specValue = specValue; | |
158 this.defValue = defValue; | |
159 } | |
160 } | |
161 | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
162 typedef Object[] TemplateArguments; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
163 |
135 | 164 enum TID |
165 { | |
166 Void = TOK.Void, | |
167 Char = TOK.Char, | |
168 Wchar = TOK.Wchar, | |
169 Dchar = TOK.Dchar, | |
170 Bool = TOK.Bool, | |
171 Byte = TOK.Byte, | |
172 Ubyte = TOK.Ubyte, | |
173 Short = TOK.Short, | |
174 Ushort = TOK.Ushort, | |
175 Int = TOK.Int, | |
176 Uint = TOK.Uint, | |
177 Long = TOK.Long, | |
178 Ulong = TOK.Ulong, | |
179 Float = TOK.Float, | |
180 Double = TOK.Double, | |
181 Real = TOK.Real, | |
182 Ifloat = TOK.Ifloat, | |
183 Idouble = TOK.Idouble, | |
184 Ireal = TOK.Ireal, | |
185 Cfloat = TOK.Cfloat, | |
186 Cdouble = TOK.Cdouble, | |
187 Creal = TOK.Creal, | |
188 | |
189 Undefined, | |
190 Function, | |
191 Delegate, | |
192 Pointer, | |
193 Array, | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
194 DotList, |
135 | 195 Identifier, |
196 Typeof, | |
153 | 197 TemplateInstance, |
135 | 198 } |
199 | |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
200 class Type : Node |
94 | 201 { |
135 | 202 TID tid; |
95 | 203 Type next; |
204 | |
135 | 205 this(TOK tok) |
206 { | |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
207 this(cast(TID)tok); |
135 | 208 } |
95 | 209 |
135 | 210 this(TID tid) |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
211 { |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
212 this(tid, null); |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
213 } |
135 | 214 |
215 this(TID tid, Type next) | |
94 | 216 { |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
217 super(NodeType.Type); |
135 | 218 this.tid = tid; |
95 | 219 this.next = next; |
94 | 220 } |
221 } | |
222 | |
134
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
223 class UndefinedType : Type |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
224 { |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
225 this() |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
226 { |
135 | 227 super(TID.Undefined, null); |
134
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
228 } |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
229 } |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
230 |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
231 class DotListType : Type |
153 | 232 { |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
233 Type[] dotList; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
234 this(Type[] dotList) |
153 | 235 { |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
236 super(TID.DotList, null); |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
237 this.dotList = dotList; |
153 | 238 } |
239 } | |
240 | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
241 /+ |
94 | 242 class IdentifierType : Type |
243 { | |
244 string[] idents; | |
245 | |
246 this(string[] idents) | |
247 { | |
135 | 248 super(TID.Identifier, null); |
94 | 249 this.idents = idents; |
250 } | |
251 | |
153 | 252 this(string ident) |
253 { | |
254 super(TID.Identifier, null); | |
255 } | |
256 | |
135 | 257 this(TID tid) |
94 | 258 { |
135 | 259 super(tid); |
94 | 260 } |
261 | |
262 void opCatAssign(string ident) | |
263 { | |
264 this.idents ~= ident; | |
265 } | |
266 } | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
267 +/ |
94 | 268 |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
269 class IdentifierType : Type |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
270 { |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
271 string ident; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
272 this(string ident) |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
273 { |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
274 super(TID.Identifier, null); |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
275 this.ident = ident; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
276 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
277 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
278 /+ |
94 | 279 class TypeofType : IdentifierType |
280 { | |
281 Expression e; | |
282 this(Expression e) | |
283 { | |
135 | 284 super(TID.Typeof); |
94 | 285 this.e = e; |
286 } | |
287 } | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
288 +/ |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
289 |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
290 class TypeofType : Type |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
291 { |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
292 Expression e; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
293 this(Expression e) |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
294 { |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
295 super(TID.Typeof, null); |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
296 this.e = e; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
297 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
298 } |
95 | 299 |
153 | 300 class TemplateInstanceType : Type |
301 { | |
302 string ident; | |
303 TemplateArguments targs; | |
304 this(string ident, TemplateArguments targs) | |
305 { | |
306 super(TID.TemplateInstance, null); | |
307 this.ident = ident; | |
308 this.targs = targs; | |
309 } | |
310 } | |
311 | |
95 | 312 class PointerType : Type |
313 { | |
314 this(Type t) | |
315 { | |
135 | 316 super(TID.Pointer, t); |
95 | 317 } |
318 } | |
319 | |
320 class ArrayType : Type | |
321 { | |
106 | 322 Expression e, e2; |
323 Type assocType; | |
324 this(Type t) | |
95 | 325 { |
135 | 326 super(TID.Array, t); |
106 | 327 } |
328 this(Type t, Expression e, Expression e2) | |
329 { | |
330 this(t); | |
95 | 331 this.e = e; |
106 | 332 this.e2 = e2; |
333 } | |
334 this(Type t, Type assocType) | |
335 { | |
336 this(t); | |
337 this.assocType = assocType; | |
95 | 338 } |
339 } | |
100 | 340 |
130 | 341 class FunctionType : Type |
342 { | |
343 Type returnType; | |
344 Parameters parameters; | |
196
ea3f66901fa4
- Added code for parsing template parameter lists for functions.
aziz
parents:
159
diff
changeset
|
345 TemplateParameter[] tparams; |
ea3f66901fa4
- Added code for parsing template parameter lists for functions.
aziz
parents:
159
diff
changeset
|
346 this(Type returnType, Parameters parameters, TemplateParameter[] tparams = null) |
130 | 347 { |
135 | 348 super(TID.Function, null); |
130 | 349 this.returnType = returnType; |
350 this.parameters = parameters; | |
196
ea3f66901fa4
- Added code for parsing template parameter lists for functions.
aziz
parents:
159
diff
changeset
|
351 this.tparams = tparams; |
130 | 352 } |
353 } | |
135 | 354 |
355 class DelegateType : Type | |
356 { | |
357 this(Type func) | |
358 { | |
359 super(TID.Delegate, func); | |
360 } | |
361 } |