annotate trunk/src/dil/ast/Types.d @ 668:a1f8d8f2db38

Renamed some identifiers.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Thu, 17 Jan 2008 19:27:46 +0100
parents 1ac758cd952a
children d8c32113afde
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
1 /++
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
2 Author: Aziz Köksal
249
32d354584b28 - Upgraded license notices to GPL3.
aziz
parents: 248
diff changeset
3 License: GPL3
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
4 +/
588
dcfec202718d Moved dil.Types to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 586
diff changeset
5 module dil.ast.Types;
562
b0533550d64c Added semantic() to VariableDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 521
diff changeset
6
580
fa6d3c52757d Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 562
diff changeset
7 import dil.ast.Node;
659
304331ca2f95 Renamed EmptyExpression to IllegalExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 655
diff changeset
8 import dil.ast.Expression;
608
fac9e8b258fc Moved dil.ast.Parameter to dil.ast.Parameters.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 606
diff changeset
9 import dil.ast.Parameters;
600
041eae272362 Moved dil.Identifier to dil.lexer.Identifier.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 596
diff changeset
10 import dil.lexer.Identifier;
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
11 import dil.Enums;
584
556bfb18dff8 Moved dil.TypeSystem to dil.semantic.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 580
diff changeset
12 import dil.semantic.Types;
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
13
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
14 enum TID
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
15 {
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
16 Void = TOK.Void,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
17 Char = TOK.Char,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
18 Wchar = TOK.Wchar,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
19 Dchar = TOK.Dchar,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
20 Bool = TOK.Bool,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
21 Byte = TOK.Byte,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
22 Ubyte = TOK.Ubyte,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
23 Short = TOK.Short,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
24 Ushort = TOK.Ushort,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
25 Int = TOK.Int,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
26 Uint = TOK.Uint,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
27 Long = TOK.Long,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
28 Ulong = TOK.Ulong,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
29 Float = TOK.Float,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
30 Double = TOK.Double,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
31 Real = TOK.Real,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
32 Ifloat = TOK.Ifloat,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
33 Idouble = TOK.Idouble,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
34 Ireal = TOK.Ireal,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
35 Cfloat = TOK.Cfloat,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
36 Cdouble = TOK.Cdouble,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
37 Creal = TOK.Creal,
521
772ffdb18fd4 Fix: added 'Cent' to enum TID.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 512
diff changeset
38 Cent = TOK.Cent,
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
39 Ucent = TOK.Ucent,
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
40
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
41 Undefined,
655
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
42 BaseClass,
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
43 Function,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
44 Delegate,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
45 Pointer,
409
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
46 CFuncPointer,
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
47 Array,
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
48 Qualified,
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
49 ModuleScope,
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
50 Identifier,
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
51 Typeof,
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
52 TemplateInstance,
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
53 Const, // D2
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
54 Invariant, // D2
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
55 }
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
56
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
57 abstract class TypeNode : Node
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
58 {
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
59 TID tid;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
60 TypeNode next;
667
1ac758cd952a Fixed a few things in DefaultVisitor.d and Pass1.d
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 659
diff changeset
61 Type type; /// The semantic type of this type node.
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
62
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
63 this(TID tid)
240
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 196
diff changeset
64 {
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 196
diff changeset
65 this(tid, null);
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 196
diff changeset
66 }
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
67
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
68 this(TID tid, TypeNode next)
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
69 {
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 269
diff changeset
70 super(NodeCategory.Type);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
71 addOptChild(next);
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
72 this.tid = tid;
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
73 this.next = next;
94
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
74 }
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
75 }
0fe650a7a8d1 - Renamed Type enum to InfoType in module Information.
aziz
parents:
diff changeset
76
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
77 class UndefinedType : TypeNode
134
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
78 {
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
79 this()
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
80 {
279
79c095aae50d - Removed null from calls to super().
aziz
parents: 275
diff changeset
81 super(TID.Undefined);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
82 mixin(set_kind);
134
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
83 }
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
84 }
a31aa0d6dd5e - Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents: 130
diff changeset
85
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
86 /// char, int, float etc.
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
87 class IntegralType : TypeNode
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
88 {
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
89 this(TOK tok)
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
90 {
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
91 super(cast(TID)tok);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
92 mixin(set_kind);
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
93 }
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
94 }
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
95
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
96 /// Identifier
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
97 class IdentifierType : TypeNode
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
98 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
99 Identifier* ident;
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
100 this(Identifier* ident)
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
101 {
279
79c095aae50d - Removed null from calls to super().
aziz
parents: 275
diff changeset
102 super(TID.Identifier);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
103 mixin(set_kind);
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
104 this.ident = ident;
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
105 }
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
106 }
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
107
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
108 /// Type "." Type
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
109 class QualifiedType : TypeNode
488
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
110 {
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
111 alias next left;
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
112 TypeNode right;
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
113 this(TypeNode left, TypeNode right)
488
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
114 {
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
115 super(TID.Qualified, left);
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
116 addChild(right);
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
117 }
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
118 }
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
119
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
120 /// "." Type
618
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
121 class ModuleScopeType : TypeNode
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
122 {
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
123 this(TypeNode next)
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
124 {
07946b379006 Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 608
diff changeset
125 super(TID.ModuleScope, next);
488
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
126 mixin(set_kind);
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
127 }
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
128 }
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 409
diff changeset
129
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
130 class TypeofType : TypeNode
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
131 {
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
132 Expression e;
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
133 this(Expression e)
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
134 {
492
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
135 this();
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
136 addChild(e);
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
137 this.e = e;
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
138 }
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
139
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
140 this()
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
141 {
279
79c095aae50d - Removed null from calls to super().
aziz
parents: 275
diff changeset
142 super(TID.Typeof);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
143 mixin(set_kind);
492
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
144 }
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
145
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
146 bool isTypeofReturn()
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
147 {
9c208925a3d4 Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
148 return e is null;
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
149 }
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
150 }
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
151
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
152 class TemplateInstanceType : TypeNode
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
153 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
154 Identifier* ident;
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
155 TemplateArguments targs;
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 495
diff changeset
156 this(Identifier* ident, TemplateArguments targs)
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
157 {
279
79c095aae50d - Removed null from calls to super().
aziz
parents: 275
diff changeset
158 super(TID.TemplateInstance);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
159 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
160 addOptChild(targs);
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
161 this.ident = ident;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
162 this.targs = targs;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
163 }
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
164 }
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 150
diff changeset
165
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
166 class PointerType : TypeNode
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
167 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
168 this(TypeNode t)
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
169 {
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
170 super(TID.Pointer, t);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
171 mixin(set_kind);
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
172 }
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
173 }
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
174
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
175 /// Dynamic array: T[] or
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
176 /// Static array: T[E] or
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
177 /// Slice array (for tuples): T[E..E] or
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
178 /// Associative array: T[T]
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
179 class ArrayType : TypeNode
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
180 {
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
181 Expression e, e2;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
182 TypeNode assocType;
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
183
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
184 this(TypeNode t)
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
185 {
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
186 super(TID.Array, t);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
187 mixin(set_kind);
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
188 }
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
189
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
190 this(TypeNode t, Expression e, Expression e2)
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
191 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
192 addChild(e);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
193 addOptChild(e2);
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
194 this.e = e;
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
195 this.e2 = e2;
295
75b47c71a34c - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 291
diff changeset
196 this(t);
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
197 }
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
198
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
199 this(TypeNode t, TypeNode assocType)
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
200 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
201 addChild(assocType);
295
75b47c71a34c - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 291
diff changeset
202 this.assocType = assocType;
106
441962b0f526 - Added parseArrayType() method.
aziz
parents: 100
diff changeset
203 this(t);
95
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
204 }
0eb4c8a5b32b - Added TOK.Invalid.
aziz
parents: 94
diff changeset
205 }
100
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 95
diff changeset
206
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
207 /// ReturnType "function" "(" Parameters? ")"
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
208 class FunctionType : TypeNode
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 117
diff changeset
209 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
210 TypeNode returnType;
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
211 Parameters params;
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
212 this(TypeNode returnType, Parameters params)
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 117
diff changeset
213 {
279
79c095aae50d - Removed null from calls to super().
aziz
parents: 275
diff changeset
214 super(TID.Function);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
215 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
216 addChild(returnType);
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
217 addChild(params);
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 117
diff changeset
218 this.returnType = returnType;
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
219 this.params = params;
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 117
diff changeset
220 }
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 117
diff changeset
221 }
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
222
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
223 /// ReturnType "delegate" "(" Parameters? ")"
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
224 class DelegateType : TypeNode
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
225 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
226 TypeNode returnType;
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
227 Parameters params;
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
228 this(TypeNode returnType, Parameters params)
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
229 {
291
c0e857931ff6 - Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents: 281
diff changeset
230 super(TID.Delegate);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
231 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
232 addChild(returnType);
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
233 addChild(params);
291
c0e857931ff6 - Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents: 281
diff changeset
234 this.returnType = returnType;
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
235 this.params = params;
135
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
236 }
145e0d68ec95 - Added enum TID to module Type.
aziz
parents: 134
diff changeset
237 }
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
238
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
239 class CFuncPointerType : TypeNode
409
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
240 {
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
241 Parameters params;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
242 this(TypeNode type, Parameters params)
409
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
243 {
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
244 super(TID.CFuncPointer, type);
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
245 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
246 addOptChild(params);
409
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
247 }
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
248 }
38fccd2640eb Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 376
diff changeset
249
668
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
250 /// "class" Identifier : BaseClass
a1f8d8f2db38 Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 667
diff changeset
251 class BaseClassType : TypeNode
655
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
252 {
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
253 Protection prot;
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
254 this(Protection prot, TypeNode type)
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
255 {
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
256 super(TID.BaseClass, type);
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
257 mixin(set_kind);
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
258 this.prot = prot;
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
259 }
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
260 }
0acc43b86bf2 Moved class BaseClass to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 648
diff changeset
261
635
b2fc028d8b55 Added class Visitor.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 618
diff changeset
262 // version(D2)
b2fc028d8b55 Added class Visitor.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 618
diff changeset
263 // {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
264 class ConstType : TypeNode
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
265 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
266 this(TypeNode t)
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
267 {
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
268 // If t is null: cast(const)
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
269 super(TID.Const, t);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
270 mixin(set_kind);
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
271 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
272 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
273
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
274 class InvariantType : TypeNode
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
275 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
276 this(TypeNode t)
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
277 {
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
278 // If t is null: cast(invariant)
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
279 super(TID.Invariant, t);
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 280
diff changeset
280 mixin(set_kind);
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
281 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 264
diff changeset
282 }
635
b2fc028d8b55 Added class Visitor.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 618
diff changeset
283 // } // version(D2)