Mercurial > projects > dil
annotate trunk/src/dil/Declarations.d @ 492:9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Moved ImportParser from module Parser to its own module. Added a few methods
from class Parser and simplified them. Now protection attributes are taken into
consideration as well.
Added class TemplateThisParameter. Adapted TypeofType so that typeof(return)
can be recognized.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Thu, 06 Dec 2007 22:19:55 +0100 |
parents | 47be6bfe39cd |
children | 9a7ca8c56e59 |
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; | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
11 import dil.Enums; |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
12 import dil.Scope; |
102 | 13 |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
14 abstract class Declaration : Node |
102 | 15 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
16 bool hasBody; |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
17 this() |
116 | 18 { |
275 | 19 super(NodeCategory.Declaration); |
116 | 20 } |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
21 |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
22 // Members relevant to semantic phase. |
490
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
23 StorageClass stc; /// The storage class of this declaration. |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
24 Protection prot; /// The protection attribute of this declaration. |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
25 |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
26 void semantic(Scope sc) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
27 { |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
28 // foreach (node; this.children) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
29 // if (node.category == NodeCategory.Declaration) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
30 // (cast(Declaration)cast(void*)node).semantic(sc); |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
31 } |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
32 |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
33 final bool isStatic() |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
34 { |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
35 return !!(stc & StorageClass.Static); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
36 } |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
37 |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
38 final bool isPublic() |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
39 { |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
40 return !!(prot & Protection.Public); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
41 } |
102 | 42 } |
43 | |
305 | 44 class Declarations : Declaration |
45 { | |
46 this() | |
47 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
48 hasBody = true; |
305 | 49 mixin(set_kind); |
50 } | |
51 | |
52 void opCatAssign(Declaration d) | |
53 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
54 addChild(d); |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
55 } |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
56 |
305 | 57 void opCatAssign(Declarations ds) |
58 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
59 addChildren(ds.children); |
305 | 60 } |
61 } | |
62 | |
129 | 63 class EmptyDeclaration : Declaration |
64 { | |
65 this() | |
66 { | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
67 mixin(set_kind); |
129 | 68 } |
69 } | |
70 | |
211 | 71 class IllegalDeclaration : Declaration |
72 { | |
292 | 73 Token* token; |
74 this(Token* token) | |
211 | 75 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
76 mixin(set_kind); |
292 | 77 this.token = token; |
211 | 78 } |
79 } | |
80 | |
364 | 81 /// FQN = fully qualified name |
82 alias Token*[] ModuleFQN; // Identifier(.Identifier)* | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
83 |
102 | 84 class ModuleDeclaration : Declaration |
85 { | |
364 | 86 Token* moduleName; |
87 Token*[] packages; | |
88 this(ModuleFQN moduleFQN) | |
102 | 89 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
90 mixin(set_kind); |
365 | 91 assert(moduleFQN.length != 0); |
92 this.moduleName = moduleFQN[$-1]; | |
93 this.packages = moduleFQN[0..$-1]; | |
94 } | |
95 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
96 char[] getFQN() |
370 | 97 { |
98 auto pname = getPackageName('.'); | |
99 if (pname.length) | |
100 return pname ~ "." ~ getName(); | |
101 else | |
102 return getName(); | |
103 } | |
104 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
105 char[] getName() |
365 | 106 { |
107 if (moduleName) | |
108 return moduleName.identifier; | |
109 return null; | |
110 } | |
111 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
112 char[] getPackageName(char separator) |
365 | 113 { |
114 char[] pname; | |
115 foreach (pckg; packages) | |
116 if (pckg) | |
117 pname ~= pckg.identifier ~ separator; | |
367
dda55fae37de
- ImportGraph.execute() can parse all modules depending on the imports of the root module.
aziz
parents:
366
diff
changeset
|
118 if (pname.length) |
dda55fae37de
- ImportGraph.execute() can parse all modules depending on the imports of the root module.
aziz
parents:
366
diff
changeset
|
119 pname = pname[0..$-1]; // Remove last separator |
365 | 120 return pname; |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
121 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
122 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
123 |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
124 class ImportDeclaration : Declaration |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
125 { |
364 | 126 ModuleFQN[] moduleFQNs; |
263 | 127 Token*[] moduleAliases; |
128 Token*[] bindNames; | |
129 Token*[] bindAliases; | |
461
c78a54b2617c
Added isStatic() and isPublic() to ImportDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
406
diff
changeset
|
130 |
366 | 131 this(ModuleFQN[] moduleFQNs, Token*[] moduleAliases, Token*[] bindNames, Token*[] bindAliases, bool isStatic) |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
132 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
133 mixin(set_kind); |
364 | 134 this.moduleFQNs = moduleFQNs; |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
135 this.moduleAliases = moduleAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
136 this.bindNames = bindNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
137 this.bindAliases = bindAliases; |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
138 if (isStatic) |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
139 this.stc |= StorageClass.Static; |
366 | 140 } |
141 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
142 char[][] getModuleFQNs(char separator) |
366 | 143 { |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
144 char[][] FQNs; |
366 | 145 foreach (moduleFQN; moduleFQNs) |
146 { | |
147 char[] FQN; | |
148 foreach (ident; moduleFQN) | |
149 if (ident) | |
150 FQN ~= ident.identifier ~ separator; | |
151 FQNs ~= FQN[0..$-1]; // Remove last separator | |
152 } | |
153 return FQNs; | |
102 | 154 } |
155 } | |
156 | |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
157 class AliasDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
158 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
159 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
160 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
161 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
162 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
163 addChild(decl); |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
164 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
165 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
166 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
167 |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
168 class TypedefDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
169 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
170 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
171 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
172 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
173 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
174 addChild(decl); |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
175 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
176 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
177 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
178 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
179 class EnumDeclaration : Declaration |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
180 { |
264 | 181 Token* name; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
182 Type baseType; |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
183 EnumMember[] members; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
184 this(Token* name, Type baseType, EnumMember[] members, bool hasBody) |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
185 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
186 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
187 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
188 addOptChild(baseType); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
189 addOptChildren(members); |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
190 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
191 this.name = name; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
192 this.baseType = baseType; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
193 this.members = members; |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
194 } |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
195 } |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
196 |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
197 class EnumMember : Node |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
198 { |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
199 Token* name; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
200 Expression value; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
201 this(Token* name, Expression value) |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
202 { |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
203 super(NodeCategory.Other); |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
204 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
205 addOptChild(value); |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
206 |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
207 this.name = name; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
208 this.value = value; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
209 } |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
210 } |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
211 |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
212 class ClassDeclaration : Declaration |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
213 { |
264 | 214 Token* name; |
258 | 215 TemplateParameters tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
216 BaseClass[] bases; |
305 | 217 Declarations decls; |
218 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls, bool hasBody) | |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
219 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
220 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
221 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
222 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
223 addOptChildren(bases); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
224 addOptChild(decls); |
305 | 225 |
112 | 226 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
227 this.tparams = tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
228 this.bases = bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
229 this.decls = decls; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
230 } |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
231 } |
112 | 232 |
233 class InterfaceDeclaration : Declaration | |
234 { | |
264 | 235 Token* name; |
258 | 236 TemplateParameters tparams; |
112 | 237 BaseClass[] bases; |
305 | 238 Declarations decls; |
239 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls, bool hasBody) | |
112 | 240 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
241 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
242 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
243 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
244 addOptChildren(bases); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
245 addOptChild(decls); |
305 | 246 |
112 | 247 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
248 this.tparams = tparams; |
112 | 249 this.bases = bases; |
250 this.decls = decls; | |
251 } | |
252 } | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
253 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
254 class StructDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
255 { |
264 | 256 Token* name; |
258 | 257 TemplateParameters tparams; |
305 | 258 Declarations decls; |
259 this(Token* name, TemplateParameters tparams, Declarations decls, bool hasBody) | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
260 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
261 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
262 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
263 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
264 addOptChild(decls); |
305 | 265 |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
266 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
267 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
268 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
269 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
270 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
271 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
272 class UnionDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
273 { |
264 | 274 Token* name; |
258 | 275 TemplateParameters tparams; |
305 | 276 Declarations decls; |
277 this(Token* name, TemplateParameters tparams, Declarations decls, bool hasBody) | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
278 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
279 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
280 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
281 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
282 addOptChild(decls); |
305 | 283 |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
284 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
285 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
286 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
287 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
288 } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
289 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
290 class ConstructorDeclaration : Declaration |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
291 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
292 Parameters parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
293 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
294 this(Parameters parameters, FunctionBody funcBody) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
295 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
296 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
297 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
298 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
299 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
300 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
301 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
302 this.funcBody = funcBody; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
303 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
304 } |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
305 |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
306 class StaticConstructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
307 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
308 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
309 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
310 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
311 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
312 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
313 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
314 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
315 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
316 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
317 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
318 |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
319 class DestructorDeclaration : Declaration |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
320 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
321 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
322 this(FunctionBody funcBody) |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
323 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
324 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
325 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
326 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
327 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
328 this.funcBody = funcBody; |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
329 } |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
330 } |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
331 |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
332 class StaticDestructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
333 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
334 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
335 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
336 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
337 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
338 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
339 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
340 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
341 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
342 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
343 } |
120 | 344 |
192 | 345 class FunctionDeclaration : Declaration |
346 { | |
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
|
347 Type returnType; |
262 | 348 Token* funcName; |
258 | 349 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
|
350 Parameters params; |
192 | 351 FunctionBody funcBody; |
492
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
352 this(Type returnType, Token* funcName, TemplateParameters tparams, |
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
353 Parameters params, FunctionBody funcBody, StorageClass stc) |
192 | 354 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
355 super.hasBody = funcBody.funcBody !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
356 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
357 addChild(returnType); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
358 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
359 addChild(params); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
360 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
361 |
492
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
362 this.stc = stc; |
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
|
363 this.returnType = returnType; |
192 | 364 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
|
365 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
|
366 this.params = params; |
192 | 367 this.funcBody = funcBody; |
368 } | |
369 } | |
370 | |
194 | 371 class VariableDeclaration : Declaration |
372 { | |
283 | 373 Type type; |
262 | 374 Token*[] idents; |
194 | 375 Expression[] values; |
283 | 376 this(Type type, Token*[] idents, Expression[] values) |
194 | 377 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
378 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
379 addOptChild(type); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
380 foreach(value; values) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
381 addOptChild(value); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
382 |
283 | 383 this.type = type; |
194 | 384 this.idents = idents; |
385 this.values = values; | |
386 } | |
387 } | |
388 | |
120 | 389 class InvariantDeclaration : Declaration |
390 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
391 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
392 this(FunctionBody funcBody) |
120 | 393 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
394 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
395 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
396 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
397 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
398 this.funcBody = funcBody; |
120 | 399 } |
400 } | |
121 | 401 |
402 class UnittestDeclaration : Declaration | |
403 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
404 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
405 this(FunctionBody funcBody) |
121 | 406 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
407 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
408 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
409 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
410 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
411 this.funcBody = funcBody; |
121 | 412 } |
413 } | |
122 | 414 |
415 class DebugDeclaration : Declaration | |
416 { | |
264 | 417 Token* spec; |
418 Token* cond; | |
305 | 419 Declaration decls, elseDecls; |
122 | 420 |
305 | 421 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
122 | 422 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
423 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
424 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
425 addOptChild(decls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
426 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
427 |
264 | 428 this.spec = spec; |
429 this.cond = cond; | |
122 | 430 this.decls = decls; |
431 this.elseDecls = elseDecls; | |
432 } | |
433 } | |
123 | 434 |
435 class VersionDeclaration : Declaration | |
436 { | |
264 | 437 Token* spec; |
438 Token* cond; | |
305 | 439 Declaration decls, elseDecls; |
123 | 440 |
305 | 441 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
123 | 442 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
443 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
444 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
445 addOptChild(decls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
446 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
447 |
264 | 448 this.spec = spec; |
449 this.cond = cond; | |
123 | 450 this.decls = decls; |
451 this.elseDecls = elseDecls; | |
452 } | |
453 } | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
454 |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
455 class StaticIfDeclaration : Declaration |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
456 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
457 Expression condition; |
305 | 458 Declaration ifDecls, elseDecls; |
459 this(Expression condition, Declaration ifDecls, Declaration elseDecls) | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
460 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
461 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
462 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
463 addChild(condition); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
464 addOptChild(ifDecls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
465 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
466 |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
467 this.condition = condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
468 this.ifDecls = ifDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
469 this.elseDecls = elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
470 } |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
471 } |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
472 |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
473 class StaticAssertDeclaration : Declaration |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
474 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
475 Expression condition, message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
476 this(Expression condition, Expression message) |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
477 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
478 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
479 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
480 addChild(condition); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
481 addOptChild(message); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
482 |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
483 this.condition = condition; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
484 this.message = message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
485 } |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
486 } |
140 | 487 |
488 class TemplateDeclaration : Declaration | |
489 { | |
292 | 490 Token* name; |
491 TemplateParameters tparams; | |
305 | 492 Declarations decls; |
493 this(Token* name, TemplateParameters tparams, Declarations decls) | |
140 | 494 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
495 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
496 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
497 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
498 addChild(decls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
499 |
292 | 500 this.name = name; |
501 this.tparams = tparams; | |
140 | 502 this.decls = decls; |
503 } | |
504 } | |
141 | 505 |
506 class NewDeclaration : Declaration | |
507 { | |
508 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
509 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
510 this(Parameters parameters, FunctionBody funcBody) |
141 | 511 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
512 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
513 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
514 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
515 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
516 |
141 | 517 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
518 this.funcBody = funcBody; |
141 | 519 } |
520 } | |
521 | |
522 class DeleteDeclaration : Declaration | |
523 { | |
524 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
525 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
526 this(Parameters parameters, FunctionBody funcBody) |
141 | 527 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
528 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
529 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
530 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
531 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
532 |
141 | 533 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
534 this.funcBody = funcBody; |
141 | 535 } |
536 } | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
537 |
149 | 538 class AttributeDeclaration : Declaration |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
539 { |
149 | 540 TOK attribute; |
305 | 541 Declaration decls; |
542 this(TOK attribute, Declaration decls) | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
543 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
544 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
545 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
546 addChild(decls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
547 |
149 | 548 this.attribute = attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
549 this.decls = decls; |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
550 } |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
551 } |
147 | 552 |
490
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
553 class ProtectionDeclaration : AttributeDeclaration |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
554 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
555 this(Protection prot, Declaration decls) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
556 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
557 super(cast(TOK)0, decls); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
558 mixin(set_kind); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
559 super.prot = prot; |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
560 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
561 |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
562 void semantic(Scope scop) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
563 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
564 /+ |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
565 void traverse(Node[] nodes) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
566 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
567 foreach (node; nodes) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
568 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
569 if (node.kind == NodeKind.ProtectionDeclaration) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
570 break; |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
571 if (node.category == NodeCategory.Declaration) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
572 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
573 auto decl = cast(Declaration)cast(void*)node; |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
574 decl.prot = this.prot; |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
575 if (node.children) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
576 traverse(node.children); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
577 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
578 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
579 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
580 traverse([this.decls]); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
581 +/ |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
582 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
583 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
584 |
149 | 585 class ExternDeclaration : AttributeDeclaration |
586 { | |
159 | 587 Linkage linkage; |
305 | 588 this(Linkage linkage, Declaration decls) |
149 | 589 { |
590 super(TOK.Extern, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
591 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
592 addOptChild(linkage); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
593 |
149 | 594 this.linkage = linkage; |
595 } | |
596 } | |
597 | |
598 class AlignDeclaration : AttributeDeclaration | |
599 { | |
600 int size; | |
305 | 601 this(int size, Declaration decls) |
149 | 602 { |
603 super(TOK.Align, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
604 mixin(set_kind); |
149 | 605 this.size = size; |
606 } | |
607 } | |
608 | |
609 class PragmaDeclaration : AttributeDeclaration | |
147 | 610 { |
245 | 611 Token* ident; |
147 | 612 Expression[] args; |
305 | 613 this(Token* ident, Expression[] args, Declaration decls) |
147 | 614 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
615 addOptChildren(args); // Add args before calling super(). |
149 | 616 super(TOK.Pragma, decls); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
617 mixin(set_kind); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
618 |
147 | 619 this.ident = ident; |
620 this.args = args; | |
621 } | |
622 } | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
623 |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
624 class MixinDeclaration : Declaration |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
625 { |
292 | 626 Expression[] templateIdents; |
252
788398655d24
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
627 Token* mixinIdent; |
292 | 628 Expression argument; // mixin ( AssignExpression ) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
629 |
292 | 630 this(Expression[] templateIdents, Token* mixinIdent) |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
631 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
632 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
633 addChildren(templateIdents); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
634 |
292 | 635 this.templateIdents = templateIdents; |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
636 this.mixinIdent = mixinIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
637 } |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
638 |
292 | 639 this(Expression argument) |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
640 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
641 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
642 addChild(argument); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
643 |
292 | 644 this.argument = argument; |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
645 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
646 } |