Mercurial > projects > dil
annotate trunk/src/dil/Declarations.d @ 364:1059295c2727
- Every command module has an execute method now.
- Added module cmd.ImportGraph.
- Renamed ModuleName to ModuleFQN.
- Added module dil.Module.
- Added member 'imports' to class Parser.
author | aziz |
---|---|
date | Fri, 31 Aug 2007 00:53:00 +0000 |
parents | 511c14950cac |
children | ed67acc82268 |
rev | line source |
---|---|
102 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
102 | 4 +/ |
326 | 5 module dil.Declarations; |
327 | 6 import dil.SyntaxTree; |
7 import dil.Expressions; | |
8 import dil.Types; | |
9 import dil.Statements; | |
10 import dil.Token; | |
102 | 11 |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
12 abstract class Declaration : Node |
102 | 13 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
14 bool hasBody; |
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
15 this(bool hasBody) |
116 | 16 { |
275 | 17 super(NodeCategory.Declaration); |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
18 this.hasBody = hasBody; |
116 | 19 } |
102 | 20 } |
21 | |
305 | 22 class Declarations : Declaration |
23 { | |
24 this() | |
25 { | |
26 super(true); | |
27 mixin(set_kind); | |
28 } | |
29 | |
30 void opCatAssign(Declaration d) | |
31 { | |
32 this.children ~= d; | |
33 } | |
34 | |
35 void opCatAssign(Declarations ds) | |
36 { | |
37 this.children ~= ds.children; | |
38 } | |
39 } | |
40 | |
129 | 41 class EmptyDeclaration : Declaration |
42 { | |
43 this() | |
44 { | |
45 super(false); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
46 mixin(set_kind); |
129 | 47 } |
48 } | |
49 | |
211 | 50 class IllegalDeclaration : Declaration |
51 { | |
292 | 52 Token* token; |
53 this(Token* token) | |
211 | 54 { |
55 super(false); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
56 mixin(set_kind); |
292 | 57 this.token = token; |
211 | 58 } |
59 } | |
60 | |
364 | 61 /// FQN = fully qualified name |
62 alias Token*[] ModuleFQN; // Identifier(.Identifier)* | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
63 |
102 | 64 class ModuleDeclaration : Declaration |
65 { | |
364 | 66 Token* moduleName; |
67 Token*[] packages; | |
68 this(ModuleFQN moduleFQN) | |
102 | 69 { |
116 | 70 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
71 mixin(set_kind); |
364 | 72 if (moduleFQN.length) |
73 { | |
74 this.moduleName = moduleFQN[$-1]; | |
75 this.packages = moduleFQN[0..$-1]; | |
76 } | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
77 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
78 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
79 |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
80 class ImportDeclaration : Declaration |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
81 { |
364 | 82 ModuleFQN[] moduleFQNs; |
263 | 83 Token*[] moduleAliases; |
84 Token*[] bindNames; | |
85 Token*[] bindAliases; | |
364 | 86 this(ModuleFQN[] moduleFQNs, Token*[] moduleAliases, Token*[] bindNames, Token*[] bindAliases) |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
87 { |
116 | 88 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
89 mixin(set_kind); |
364 | 90 this.moduleFQNs = moduleFQNs; |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
91 this.moduleAliases = moduleAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
92 this.bindNames = bindNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
93 this.bindAliases = bindAliases; |
102 | 94 } |
95 } | |
96 | |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
97 class AliasDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
98 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
99 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
100 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
101 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
102 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
103 mixin(set_kind); |
292 | 104 this.children = [decl]; |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
105 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
106 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
107 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
108 |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
109 class TypedefDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
110 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
111 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
112 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
113 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
114 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
115 mixin(set_kind); |
292 | 116 this.children = [decl]; |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
117 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
118 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
119 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
120 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
121 class EnumDeclaration : Declaration |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
122 { |
264 | 123 Token* name; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
124 Type baseType; |
264 | 125 Token*[] members; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
126 Expression[] values; |
264 | 127 this(Token* name, Type baseType, Token*[] members, Expression[] values, bool hasBody) |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
128 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
129 super(hasBody); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
130 mixin(set_kind); |
300
6cf3a5069109
- Fix: adding only non-null members to this.children in EnumDeclaration ctor.
aziz
parents:
299
diff
changeset
|
131 if (baseType) |
6cf3a5069109
- Fix: adding only non-null members to this.children in EnumDeclaration ctor.
aziz
parents:
299
diff
changeset
|
132 this.children = [baseType]; |
6cf3a5069109
- Fix: adding only non-null members to this.children in EnumDeclaration ctor.
aziz
parents:
299
diff
changeset
|
133 foreach(value; values) |
6cf3a5069109
- Fix: adding only non-null members to this.children in EnumDeclaration ctor.
aziz
parents:
299
diff
changeset
|
134 if (value) |
6cf3a5069109
- Fix: adding only non-null members to this.children in EnumDeclaration ctor.
aziz
parents:
299
diff
changeset
|
135 this.children ~= value; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
136 this.name = name; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
137 this.baseType = baseType; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
138 this.members = members; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
139 this.values = values; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
140 } |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
141 } |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
142 |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
143 class ClassDeclaration : Declaration |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
144 { |
264 | 145 Token* name; |
258 | 146 TemplateParameters tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
147 BaseClass[] bases; |
305 | 148 Declarations decls; |
149 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls, bool hasBody) | |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
150 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
151 super(hasBody); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
152 mixin(set_kind); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
153 if (tparams) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
154 this.children = [tparams]; |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
155 if (bases.length) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
156 this.children ~= bases; |
305 | 157 this.children ~= decls; |
158 | |
112 | 159 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
160 this.tparams = tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
161 this.bases = bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
162 this.decls = decls; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
163 } |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
164 } |
112 | 165 |
166 class InterfaceDeclaration : Declaration | |
167 { | |
264 | 168 Token* name; |
258 | 169 TemplateParameters tparams; |
112 | 170 BaseClass[] bases; |
305 | 171 Declarations decls; |
172 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls, bool hasBody) | |
112 | 173 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
174 super(hasBody); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
175 mixin(set_kind); |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
176 if (tparams) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
177 this.children = [tparams]; |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
178 if (bases.length) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
179 this.children ~= bases; |
305 | 180 this.children ~= decls; |
181 | |
112 | 182 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
183 this.tparams = tparams; |
112 | 184 this.bases = bases; |
185 this.decls = decls; | |
186 } | |
187 } | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
188 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
189 class StructDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
190 { |
264 | 191 Token* name; |
258 | 192 TemplateParameters tparams; |
305 | 193 Declarations decls; |
194 this(Token* name, TemplateParameters tparams, Declarations decls, bool hasBody) | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
195 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
196 super(hasBody); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
197 mixin(set_kind); |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
198 if (tparams) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
199 this.children = [tparams]; |
305 | 200 this.children ~= decls; |
201 | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
202 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
203 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
204 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
205 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
206 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
207 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
208 class UnionDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
209 { |
264 | 210 Token* name; |
258 | 211 TemplateParameters tparams; |
305 | 212 Declarations decls; |
213 this(Token* name, TemplateParameters tparams, Declarations decls, bool hasBody) | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
214 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
215 super(hasBody); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
216 mixin(set_kind); |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
217 if (tparams) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
218 this.children = [tparams]; |
305 | 219 this.children ~= decls; |
220 | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
221 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
222 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
223 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
224 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
225 } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
226 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
227 class ConstructorDeclaration : Declaration |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
228 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
229 Parameters parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
230 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
231 this(Parameters parameters, FunctionBody funcBody) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
232 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
233 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
234 mixin(set_kind); |
292 | 235 this.children = [cast(Node)parameters, funcBody]; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
236 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
237 this.funcBody = funcBody; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
238 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
239 } |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
240 |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
241 class StaticConstructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
242 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
243 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
244 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
245 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
246 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
247 mixin(set_kind); |
292 | 248 this.children = [funcBody]; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
249 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
250 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
251 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
252 |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
253 class DestructorDeclaration : Declaration |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
254 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
255 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
256 this(FunctionBody funcBody) |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
257 { |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
258 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
259 mixin(set_kind); |
292 | 260 this.children = [funcBody]; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
261 this.funcBody = funcBody; |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
262 } |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
263 } |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
264 |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
265 class StaticDestructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
266 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
267 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
268 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
269 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
270 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
271 mixin(set_kind); |
292 | 272 this.children = [funcBody]; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
273 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
274 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
275 } |
120 | 276 |
192 | 277 class FunctionDeclaration : Declaration |
278 { | |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
279 Type returnType; |
262 | 280 Token* funcName; |
258 | 281 TemplateParameters tparams; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
282 Parameters params; |
192 | 283 FunctionBody funcBody; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
284 this(Type returnType, Token* funcName, TemplateParameters tparams, Parameters params, FunctionBody funcBody) |
192 | 285 { |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
286 assert(returnType !is null); |
194 | 287 super(funcBody.funcBody !is null); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
288 mixin(set_kind); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
289 this.children = [returnType]; |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
290 if (tparams) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
291 this.children ~= tparams; |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
292 this.children ~= [cast(Node)params, funcBody]; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
293 this.returnType = returnType; |
192 | 294 this.funcName = funcName; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
295 this.tparams = tparams; |
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
296 this.params = params; |
192 | 297 this.funcBody = funcBody; |
298 } | |
299 } | |
300 | |
194 | 301 class VariableDeclaration : Declaration |
302 { | |
283 | 303 Type type; |
262 | 304 Token*[] idents; |
194 | 305 Expression[] values; |
283 | 306 this(Type type, Token*[] idents, Expression[] values) |
194 | 307 { |
308 super(false); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
309 mixin(set_kind); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
310 if (type) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
311 this.children = [type]; |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
312 foreach(value; values) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
313 if (value) |
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
314 this.children ~= value; |
283 | 315 this.type = type; |
194 | 316 this.idents = idents; |
317 this.values = values; | |
318 } | |
319 } | |
320 | |
120 | 321 class InvariantDeclaration : Declaration |
322 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
323 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
324 this(FunctionBody funcBody) |
120 | 325 { |
326 super(true); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
327 mixin(set_kind); |
292 | 328 this.children = [funcBody]; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
329 this.funcBody = funcBody; |
120 | 330 } |
331 } | |
121 | 332 |
333 class UnittestDeclaration : Declaration | |
334 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
335 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
336 this(FunctionBody funcBody) |
121 | 337 { |
338 super(true); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
339 mixin(set_kind); |
292 | 340 this.children = [funcBody]; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
341 this.funcBody = funcBody; |
121 | 342 } |
343 } | |
122 | 344 |
345 class DebugDeclaration : Declaration | |
346 { | |
264 | 347 Token* spec; |
348 Token* cond; | |
305 | 349 Declaration decls, elseDecls; |
122 | 350 |
305 | 351 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
122 | 352 { |
305 | 353 super(true /+decls.length != 0+/); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
354 mixin(set_kind); |
313
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
355 if (decls) |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
356 this.children = [decls]; |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
357 if (elseDecls) |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
358 this.children ~= elseDecls; |
264 | 359 this.spec = spec; |
360 this.cond = cond; | |
122 | 361 this.decls = decls; |
362 this.elseDecls = elseDecls; | |
363 } | |
364 } | |
123 | 365 |
366 class VersionDeclaration : Declaration | |
367 { | |
264 | 368 Token* spec; |
369 Token* cond; | |
305 | 370 Declaration decls, elseDecls; |
123 | 371 |
305 | 372 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
123 | 373 { |
305 | 374 super(true /+decls.length != 0+/); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
375 mixin(set_kind); |
313
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
376 if (decls) |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
377 this.children = [decls]; |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
378 if (elseDecls) |
1c1adededd8f
- Fix: assign new EmptyDeclaration to decls when parsing PragmaStatement.
aziz
parents:
305
diff
changeset
|
379 this.children ~= elseDecls; |
264 | 380 this.spec = spec; |
381 this.cond = cond; | |
123 | 382 this.decls = decls; |
383 this.elseDecls = elseDecls; | |
384 } | |
385 } | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
386 |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
387 class StaticIfDeclaration : Declaration |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
388 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
389 Expression condition; |
305 | 390 Declaration ifDecls, elseDecls; |
391 this(Expression condition, Declaration ifDecls, Declaration elseDecls) | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
392 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
393 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
394 mixin(set_kind); |
305 | 395 this.children = [cast(Node)condition, ifDecls, elseDecls]; |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
396 this.condition = condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
397 this.ifDecls = ifDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
398 this.elseDecls = elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
399 } |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
400 } |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
401 |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
402 class StaticAssertDeclaration : Declaration |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
403 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
404 Expression condition, message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
405 this(Expression condition, Expression message) |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
406 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
407 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
408 mixin(set_kind); |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
409 this.children = [condition]; |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
410 if (message) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
411 this.children ~= message; |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
412 this.condition = condition; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
413 this.message = message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
414 } |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
415 } |
140 | 416 |
417 class TemplateDeclaration : Declaration | |
418 { | |
292 | 419 Token* name; |
420 TemplateParameters tparams; | |
305 | 421 Declarations decls; |
422 this(Token* name, TemplateParameters tparams, Declarations decls) | |
140 | 423 { |
424 super(true); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
425 mixin(set_kind); |
305 | 426 this.children = [cast(Node)tparams, decls]; |
292 | 427 this.name = name; |
428 this.tparams = tparams; | |
140 | 429 this.decls = decls; |
430 } | |
431 } | |
141 | 432 |
433 class NewDeclaration : Declaration | |
434 { | |
435 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
436 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
437 this(Parameters parameters, FunctionBody funcBody) |
141 | 438 { |
439 super(true); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
440 mixin(set_kind); |
292 | 441 this.children = [cast(Node)parameters, funcBody]; |
141 | 442 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
443 this.funcBody = funcBody; |
141 | 444 } |
445 } | |
446 | |
447 class DeleteDeclaration : Declaration | |
448 { | |
449 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
450 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
451 this(Parameters parameters, FunctionBody funcBody) |
141 | 452 { |
453 super(true); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
454 mixin(set_kind); |
292 | 455 this.children = [cast(Node)parameters, funcBody]; |
141 | 456 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
457 this.funcBody = funcBody; |
141 | 458 } |
459 } | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
460 |
149 | 461 class AttributeDeclaration : Declaration |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
462 { |
149 | 463 TOK attribute; |
305 | 464 Declaration decls; |
465 this(TOK attribute, Declaration decls) | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
466 { |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
467 super(true); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
468 mixin(set_kind); |
305 | 469 this.children = [decls]; |
149 | 470 this.attribute = attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
471 this.decls = decls; |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
472 } |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
473 } |
147 | 474 |
149 | 475 class ExternDeclaration : AttributeDeclaration |
476 { | |
159 | 477 Linkage linkage; |
305 | 478 this(Linkage linkage, Declaration decls) |
149 | 479 { |
480 super(TOK.Extern, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
481 mixin(set_kind); |
359
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
327
diff
changeset
|
482 if (linkage) |
511c14950cac
- Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents:
327
diff
changeset
|
483 this.children ~= linkage; |
149 | 484 this.linkage = linkage; |
485 } | |
486 } | |
487 | |
488 class AlignDeclaration : AttributeDeclaration | |
489 { | |
490 int size; | |
305 | 491 this(int size, Declaration decls) |
149 | 492 { |
493 super(TOK.Align, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
494 mixin(set_kind); |
149 | 495 this.size = size; |
496 } | |
497 } | |
498 | |
499 class PragmaDeclaration : AttributeDeclaration | |
147 | 500 { |
245 | 501 Token* ident; |
147 | 502 Expression[] args; |
305 | 503 this(Token* ident, Expression[] args, Declaration decls) |
147 | 504 { |
149 | 505 super(TOK.Pragma, decls); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
506 mixin(set_kind); |
301
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
507 if (args.length) |
caef255a2801
- Fix in some ctors: adding only non-null members to this.children.
aziz
parents:
300
diff
changeset
|
508 this.children ~= args; |
147 | 509 this.ident = ident; |
510 this.args = args; | |
511 } | |
512 } | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
513 |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
514 class MixinDeclaration : Declaration |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
515 { |
292 | 516 Expression[] templateIdents; |
252
788398655d24
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
517 Token* mixinIdent; |
292 | 518 Expression argument; // mixin ( AssignExpression ) |
519 this(Expression[] templateIdents, Token* mixinIdent) | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
520 { |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
521 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
522 mixin(set_kind); |
292 | 523 this.children = templateIdents; |
524 this.templateIdents = templateIdents; | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
525 this.mixinIdent = mixinIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
526 } |
292 | 527 this(Expression argument) |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
528 { |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
529 super(false); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
530 mixin(set_kind); |
292 | 531 this.children = [argument]; |
532 this.argument = argument; | |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
533 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
534 } |