Mercurial > projects > dil
annotate src/dil/ast/Type.d @ 839:4063da6f3edd default tip
Refactored the config file and how it is loaded.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Thu, 21 Aug 2008 17:51:04 +0200 |
parents | bcb74c9b895c |
children |
rev | line source |
---|---|
701
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
1 /++ |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
2 Author: Aziz Köksal |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
3 License: GPL3 |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
4 +/ |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
5 module dil.ast.Type; |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
6 |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
7 import dil.ast.Node; |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
8 import dil.semantic.Types; |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
9 |
769
5e3ef1b2011c
Added and improved documentation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
737
diff
changeset
|
10 /// The root class of all type nodes. |
701
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
11 abstract class TypeNode : Node |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
12 { |
769
5e3ef1b2011c
Added and improved documentation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
737
diff
changeset
|
13 TypeNode next; /// The next type in the type chain. |
701
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
14 Type type; /// The semantic type of this type node. |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
15 |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
16 this() |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
17 { |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
18 this(null); |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
19 } |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
20 |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
21 this(TypeNode next) |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
22 { |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
23 super(NodeCategory.Type); |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
24 addOptChild(next); |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
25 this.next = next; |
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
26 } |
737
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
27 |
769
5e3ef1b2011c
Added and improved documentation.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
737
diff
changeset
|
28 /// Returns the root type of the type chain. |
737
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
29 TypeNode baseType() |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
30 { |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
31 auto type = this; |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
32 while (type.next) |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
33 type = type.next; |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
34 return type; |
f88b5285b86b
Implemented DDocEmitter.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
701
diff
changeset
|
35 } |
791
5fe89bb8cbdd
Implemented syntax tree copying.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
769
diff
changeset
|
36 |
5fe89bb8cbdd
Implemented syntax tree copying.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
769
diff
changeset
|
37 override abstract TypeNode copy(); |
701
65ad2f96df1f
Moved TypeNode to new module dil.ast.Type.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff
changeset
|
38 } |