Mercurial > projects > dil
annotate trunk/src/dil/Types.d @ 409:38fccd2640eb
Added code for parsing C function pointer declarations.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 25 Sep 2007 12:15:49 +0200 |
parents | 5ebe80ce84f2 |
children | cfb3805768b6 |
rev | line source |
---|---|
94 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
94 | 4 +/ |
326 | 5 module dil.Types; |
327 | 6 import dil.SyntaxTree; |
7 import dil.Token; | |
8 import dil.Expressions; | |
94 | 9 |
359
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
10 class Linkage : Node |
159 | 11 { |
359
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
12 enum Type |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
13 { |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
14 Extern, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
15 C, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
16 Cpp, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
17 D, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
18 Windows, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
19 Pascal, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
20 System |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
21 } |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
22 |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
23 /++ |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
24 This enum is used by the parser to find redundant |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
25 or conflicting extern attribute declarations. |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
26 +/ |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
27 enum Category |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
28 { |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
29 Unset, |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
30 ExternSymbol = 1<<1, /// Extern |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
31 MangleSymbol = 1<<2 /// C, Cpp, D, Windows, Pascal, System |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
32 } |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
33 |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
34 Linkage.Type type; |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
35 |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
36 this(typeof(type) type) |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
37 { |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
38 super(NodeCategory.Other); |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
39 mixin(set_kind); |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
40 this.type = type; |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
41 } |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
42 |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
43 static Category getCategory(Linkage linkage) |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
44 { |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
45 if (linkage is null) |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
46 return Category.ExternSymbol; |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
47 else |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
48 return Category.MangleSymbol; |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
357
diff
changeset
|
49 } |
159 | 50 } |
51 | |
95 | 52 enum StorageClass |
53 { | |
54 None = 0, | |
55 Abstract = 1, | |
56 Auto = 1<<2, | |
57 Const = 1<<3, | |
58 Deprecated = 1<<4, | |
59 Extern = 1<<5, | |
60 Final = 1<<6, | |
61 Invariant = 1<<7, | |
62 Override = 1<<8, | |
63 Scope = 1<<9, | |
64 Static = 1<<10, | |
65 Synchronized = 1<<11, | |
66 In = 1<<12, | |
67 Out = 1<<13, | |
68 Ref = 1<<14, | |
69 Lazy = 1<<15, | |
70 Variadic = 1<<16, | |
71 } | |
72 | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
73 class Parameter : Node |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
74 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
75 StorageClass stc; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
76 Token* stcTok; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
77 Type type; |
253
4279b638c63e
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
78 Token* ident; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
79 Expression assignExpr; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
80 |
253
4279b638c63e
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
81 this(Token* stcTok, Type type, Token* ident, Expression assignExpr) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
82 { |
275 | 83 super(NodeCategory.Other); |
281 | 84 mixin(set_kind); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
295
diff
changeset
|
85 if (type) // type can be null when param in foreach statement |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
295
diff
changeset
|
86 this.children = [type]; |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
87 if (assignExpr) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
88 this.children ~= assignExpr; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
89 |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
90 StorageClass stc; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
91 if (stcTok !is null) |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
92 { |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
93 // 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
|
94 switch (stcTok.type) |
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 // TODO: D 2.0 invariant/const/final/scope |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
97 case TOK.In: stc = StorageClass.In; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
98 case TOK.Out: stc = StorageClass.Out; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
99 case TOK.Inout: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
100 case TOK.Ref: stc = StorageClass.Ref; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
101 case TOK.Lazy: stc = StorageClass.Lazy; break; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
102 case TOK.Ellipses: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
103 stc = StorageClass.Variadic; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
104 default: |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
105 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
106 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
107 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
108 this.stc = stc; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
109 this.stcTok = stcTok; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
110 this.type = type; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
111 this.ident = ident; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
112 this.assignExpr = assignExpr; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
113 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
114 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
115 bool isVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
116 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
117 return !!(stc & StorageClass.Variadic); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
118 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
119 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
120 bool isOnlyVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
121 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
122 return stc == StorageClass.Variadic; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
123 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
124 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
125 |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
126 class Parameters : Node |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
127 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
128 this() |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
129 { |
275 | 130 super(NodeCategory.Other); |
281 | 131 mixin(set_kind); |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
132 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
133 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
134 bool hasVariadic() |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
135 { |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
136 if (children.length != 0) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
137 return items[$-1].isVariadic(); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
138 return false; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
139 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
140 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
141 void opCatAssign(Parameter param) |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
142 { children ~= param; } |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
143 |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
144 Parameter[] items() |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
145 { return cast(Parameter[])children; } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
146 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
147 size_t length() |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
148 { return children.length; } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
149 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
106
diff
changeset
|
150 |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
151 |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
152 enum Protection |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
153 { |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
154 None, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
155 Private = 1, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
156 Protected = 1<<1, |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
157 Package = 1<<2, |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
158 Public = 1<<3, |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
159 Export = 1<<4 |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
160 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
161 |
281 | 162 class BaseClass : Node |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
163 { |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
164 Protection prot; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
165 Type type; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
166 this(Protection prot, Type type) |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
167 { |
281 | 168 super(NodeCategory.Other); |
169 mixin(set_kind); | |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
170 this.children = [type]; |
158
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
171 this.prot = prot; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
172 this.type = type; |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
173 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
174 } |
759f437313f9
- Moved enum Protection and class BaseClass to module Types.
aziz
parents:
154
diff
changeset
|
175 |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
176 abstract class TemplateParameter : Node |
137 | 177 { |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
178 this() |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
179 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
180 super(NodeCategory.Other); |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
181 } |
137 | 182 } |
183 | |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
184 class TemplateAliasParameter : TemplateParameter |
137 | 185 { |
253
4279b638c63e
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
186 Token* ident; |
137 | 187 Type specType, defType; |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
188 this(Token* ident, Type specType, Type defType) |
137 | 189 { |
281 | 190 mixin(set_kind); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
191 if (specType) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
192 this.children ~= specType; |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
193 if (defType) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
194 this.children ~= defType; |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
195 this.ident = ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
196 this.specType = specType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
197 this.defType = defType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
198 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
199 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
200 |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
201 class TemplateTypeParameter : TemplateParameter |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
202 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
203 Token* ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
204 Type specType, defType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
205 this(Token* ident, Type specType, Type defType) |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
206 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
207 mixin(set_kind); |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
208 if (specType) |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
209 this.children ~= specType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
210 if (defType) |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
211 this.children ~= defType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
212 this.ident = ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
213 this.specType = specType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
214 this.defType = defType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
215 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
216 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
217 |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
218 class TemplateValueParameter : TemplateParameter |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
219 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
220 Type valueType; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
221 Token* ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
222 Expression specValue, defValue; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
223 this(Type valueType, Token* ident, Expression specValue, Expression defValue) |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
224 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
225 mixin(set_kind); |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
226 this.children ~= valueType; |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
227 if (specValue) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
228 this.children ~= specValue; |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
229 if (defValue) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
230 this.children ~= defValue; |
137 | 231 this.valueType = valueType; |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
232 this.ident = ident; |
137 | 233 this.specValue = specValue; |
234 this.defValue = defValue; | |
235 } | |
236 } | |
237 | |
340
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
238 class TemplateTupleParameter : TemplateParameter |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
239 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
240 Token* ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
241 this(Token* ident) |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
242 { |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
243 mixin(set_kind); |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
244 this.ident = ident; |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
245 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
246 } |
1accb3013bd2
- Changed class TemplateParameter to an abstract class.
aziz
parents:
327
diff
changeset
|
247 |
258 | 248 class TemplateParameters : Node |
249 { | |
250 this() | |
251 { | |
275 | 252 super(NodeCategory.Other); |
281 | 253 mixin(set_kind); |
258 | 254 } |
255 | |
256 void opCatAssign(TemplateParameter parameter) | |
257 { | |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
258 this.children ~= parameter; |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
259 } |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
260 |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
261 TemplateParameter[] items() |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
262 { |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
263 return cast(TemplateParameter[])children; |
258 | 264 } |
265 } | |
266 | |
254
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
267 class TemplateArguments : Node |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
268 { |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
269 this() |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
270 { |
275 | 271 super(NodeCategory.Other); |
281 | 272 mixin(set_kind); |
254
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
273 } |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
274 |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
275 void opCatAssign(Node argument) |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
276 { |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
277 this.children ~= argument; |
254
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
278 } |
eb6e3f1fbfee
- Removed typedef and created a proper TemplateArguments class.
aziz
parents:
253
diff
changeset
|
279 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
137
diff
changeset
|
280 |
135 | 281 enum TID |
282 { | |
283 Void = TOK.Void, | |
284 Char = TOK.Char, | |
285 Wchar = TOK.Wchar, | |
286 Dchar = TOK.Dchar, | |
287 Bool = TOK.Bool, | |
288 Byte = TOK.Byte, | |
289 Ubyte = TOK.Ubyte, | |
290 Short = TOK.Short, | |
291 Ushort = TOK.Ushort, | |
292 Int = TOK.Int, | |
293 Uint = TOK.Uint, | |
294 Long = TOK.Long, | |
295 Ulong = TOK.Ulong, | |
296 Float = TOK.Float, | |
297 Double = TOK.Double, | |
298 Real = TOK.Real, | |
299 Ifloat = TOK.Ifloat, | |
300 Idouble = TOK.Idouble, | |
301 Ireal = TOK.Ireal, | |
302 Cfloat = TOK.Cfloat, | |
303 Cdouble = TOK.Cdouble, | |
304 Creal = TOK.Creal, | |
305 | |
306 Undefined, | |
307 Function, | |
308 Delegate, | |
309 Pointer, | |
409
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
310 CFuncPointer, |
135 | 311 Array, |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
312 DotList, |
135 | 313 Identifier, |
314 Typeof, | |
153 | 315 TemplateInstance, |
269 | 316 Const, // D2 |
317 Invariant, // D2 | |
135 | 318 } |
319 | |
280 | 320 abstract class Type : Node |
94 | 321 { |
135 | 322 TID tid; |
95 | 323 Type next; |
324 | |
135 | 325 this(TID tid) |
240
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
326 { |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
327 this(tid, null); |
deab661906ae
- Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents:
196
diff
changeset
|
328 } |
135 | 329 |
330 this(TID tid, Type next) | |
94 | 331 { |
275 | 332 super(NodeCategory.Type); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
333 if (next) |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
334 this.children ~= next; |
135 | 335 this.tid = tid; |
95 | 336 this.next = next; |
94 | 337 } |
338 } | |
339 | |
280 | 340 class IntegralType : Type |
341 { | |
342 this(TOK tok) | |
343 { | |
344 super(cast(TID)tok); | |
281 | 345 mixin(set_kind); |
280 | 346 } |
347 } | |
348 | |
134
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
349 class UndefinedType : Type |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
350 { |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
351 this() |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
352 { |
279 | 353 super(TID.Undefined); |
281 | 354 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
|
355 } |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
356 } |
a31aa0d6dd5e
- Added class UndefinedType. Returning it in parseBasicType() when no token matched the basic type list.
aziz
parents:
130
diff
changeset
|
357 |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
358 class DotListType : Type |
153 | 359 { |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
360 Type[] dotList; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
361 this(Type[] dotList) |
153 | 362 { |
279 | 363 super(TID.DotList); |
281 | 364 mixin(set_kind); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
365 this.children ~= dotList; |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
366 this.dotList = dotList; |
153 | 367 } |
368 } | |
369 | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
370 class IdentifierType : Type |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
371 { |
264 | 372 Token* ident; |
373 this(Token* ident) | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
374 { |
279 | 375 super(TID.Identifier); |
281 | 376 mixin(set_kind); |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
377 this.ident = ident; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
378 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
379 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
380 |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
381 class TypeofType : Type |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
382 { |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
383 Expression e; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
384 this(Expression e) |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
385 { |
279 | 386 super(TID.Typeof); |
281 | 387 mixin(set_kind); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
388 this.children ~= e; |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
389 this.e = e; |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
390 } |
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
391 } |
95 | 392 |
153 | 393 class TemplateInstanceType : Type |
394 { | |
264 | 395 Token* ident; |
153 | 396 TemplateArguments targs; |
264 | 397 this(Token* ident, TemplateArguments targs) |
153 | 398 { |
279 | 399 super(TID.TemplateInstance); |
281 | 400 mixin(set_kind); |
376 | 401 if (targs) |
402 this.children ~= targs; | |
153 | 403 this.ident = ident; |
404 this.targs = targs; | |
405 } | |
406 } | |
407 | |
95 | 408 class PointerType : Type |
409 { | |
410 this(Type t) | |
411 { | |
135 | 412 super(TID.Pointer, t); |
281 | 413 mixin(set_kind); |
95 | 414 } |
415 } | |
416 | |
417 class ArrayType : Type | |
418 { | |
106 | 419 Expression e, e2; |
420 Type assocType; | |
421 this(Type t) | |
95 | 422 { |
135 | 423 super(TID.Array, t); |
281 | 424 mixin(set_kind); |
106 | 425 } |
426 this(Type t, Expression e, Expression e2) | |
427 { | |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
299
diff
changeset
|
428 this.children = [e]; |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
299
diff
changeset
|
429 if (e2) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
299
diff
changeset
|
430 this.children ~= e2; |
95 | 431 this.e = e; |
106 | 432 this.e2 = e2; |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
433 this(t); |
106 | 434 } |
435 this(Type t, Type assocType) | |
436 { | |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
437 this.children = [assocType]; |
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
438 this.assocType = assocType; |
106 | 439 this(t); |
95 | 440 } |
441 } | |
100 | 442 |
130 | 443 class FunctionType : Type |
444 { | |
445 Type returnType; | |
446 Parameters parameters; | |
291
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
447 this(Type returnType, Parameters parameters) |
130 | 448 { |
279 | 449 super(TID.Function); |
281 | 450 mixin(set_kind); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
451 this.children = [cast(Node)returnType, parameters]; |
130 | 452 this.returnType = returnType; |
453 this.parameters = parameters; | |
454 } | |
455 } | |
135 | 456 |
457 class DelegateType : Type | |
458 { | |
291
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
459 Type returnType; |
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
460 Parameters parameters; |
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
461 this(Type returnType, Parameters parameters) |
135 | 462 { |
291
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
463 super(TID.Delegate); |
281 | 464 mixin(set_kind); |
295
75b47c71a34c
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
291
diff
changeset
|
465 this.children = [cast(Node)returnType, parameters]; |
291
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
466 this.returnType = returnType; |
c0e857931ff6
- Changed FunctionType and DelegateType. Both receive return type and parameters.
aziz
parents:
281
diff
changeset
|
467 this.parameters = parameters; |
135 | 468 } |
469 } | |
269 | 470 |
409
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
471 class CFuncPointerType : Type |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
472 { |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
473 Parameters params; |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
474 this(Type type, Parameters params) |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
475 { |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
476 super(TID.CFuncPointer, type); |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
477 mixin(set_kind); |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
478 if (params) |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
479 this.children ~= params; |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
480 } |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
481 } |
38fccd2640eb
Added code for parsing C function pointer declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
376
diff
changeset
|
482 |
269 | 483 version(D2) |
484 { | |
485 class ConstType : Type | |
486 { | |
487 this(Type t) | |
488 { | |
489 // If t is null: cast(const) | |
490 super(TID.Const, t); | |
281 | 491 mixin(set_kind); |
269 | 492 } |
493 } | |
494 | |
495 class InvariantType : Type | |
496 { | |
497 this(Type t) | |
498 { | |
499 // If t is null: cast(invariant) | |
500 super(TID.Invariant, t); | |
281 | 501 mixin(set_kind); |
269 | 502 } |
503 } | |
504 } // version(D2) |