Mercurial > projects > dang
comparison ast/Decl.d @ 144:6e6355fb5f0f
- Parsing nested attributes.
- Creating classes and interfaces in AST.
- Updated AstPrinter to print attributes, classes and interfaces.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Mon, 21 Jul 2008 17:41:40 +0200 |
parents | 2be29b296081 |
children | a14ac9e5c858 |
comparison
equal
deleted
inserted
replaced
143:d76cc5cad4fc | 144:6e6355fb5f0f |
---|---|
18 VarDecl, | 18 VarDecl, |
19 DummyDecl, | 19 DummyDecl, |
20 ImportDecl, | 20 ImportDecl, |
21 FuncDecl, | 21 FuncDecl, |
22 StructDecl, | 22 StructDecl, |
23 ClassDecl, | |
24 InterfaceDecl, | |
23 } | 25 } |
24 | 26 |
25 class Decl | 27 class Decl |
26 { | 28 { |
27 this(DeclType declType) | 29 this(DeclType declType) |
218 Identifier identifier; | 220 Identifier identifier; |
219 Decl[] decls; | 221 Decl[] decls; |
220 private DType myType; | 222 private DType myType; |
221 } | 223 } |
222 | 224 |
225 class ClassDecl : Decl | |
226 { | |
227 this(Identifier identifier) | |
228 { | |
229 super(DeclType.ClassDecl); | |
230 this.identifier = identifier; | |
231 } | |
232 | |
233 void addMember(Decl decl) | |
234 { | |
235 decls ~= decl; | |
236 } | |
237 | |
238 void addBaseClass(Identifier identifier) | |
239 { | |
240 baseClasses ~= identifier; | |
241 } | |
242 | |
243 void simplify() | |
244 { | |
245 } | |
246 | |
247 override DType type() | |
248 { | |
249 return env.findType(identifier); | |
250 } | |
251 | |
252 Identifier identifier; | |
253 Identifier[] baseClasses; | |
254 Decl[] decls; | |
255 private DType myType; | |
256 } | |
257 | |
258 class InterfaceDecl : Decl | |
259 { | |
260 this(Identifier identifier) | |
261 { | |
262 super(DeclType.InterfaceDecl); | |
263 this.identifier = identifier; | |
264 } | |
265 | |
266 void addMember(Decl decl) | |
267 { | |
268 decls ~= decl; | |
269 } | |
270 | |
271 void addBaseClass(Identifier identifier) | |
272 { | |
273 baseClasses ~= identifier; | |
274 } | |
275 | |
276 void simplify() | |
277 { | |
278 } | |
279 | |
280 override DType type() | |
281 { | |
282 return env.findType(identifier); | |
283 } | |
284 | |
285 Identifier identifier; | |
286 Identifier[] baseClasses; | |
287 Decl[] decls; | |
288 private DType myType; | |
289 } | |
290 |