Mercurial > projects > dil
comparison trunk/src/dil/ast/DefaultVisitor.d @ 791:5fe89bb8cbdd
Implemented syntax tree copying.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Tue, 26 Feb 2008 20:13:41 +0100 |
parents | 3b34f6a95a27 |
children | cf2ad5df025c |
comparison
equal
deleted
inserted
replaced
790:a83a07f6233d | 791:5fe89bb8cbdd |
---|---|
107 { | 107 { |
108 alias T E; | 108 alias T E; |
109 static if (is(E == IllegalExpression)) | 109 static if (is(E == IllegalExpression)) |
110 {} | 110 {} |
111 else | 111 else |
112 static if (is(E : CondExpression)) | 112 static if (is(E == CondExpression)) |
113 visitE(e.condition), visitE(e.lhs), visitE(e.rhs); | 113 visitE(e.condition), visitE(e.lhs), visitE(e.rhs); |
114 else | 114 else |
115 static if (is(E : BinaryExpression)) | 115 static if (is(E : BinaryExpression)) |
116 visitE(e.lhs), visitE(e.rhs); | 116 visitE(e.lhs), visitE(e.rhs); |
117 else | 117 else |
190 else | 190 else |
191 static if (is(T : Statement)) | 191 static if (is(T : Statement)) |
192 { | 192 { |
193 alias T S; | 193 alias T S; |
194 static if (is(S == CompoundStatement)) | 194 static if (is(S == CompoundStatement)) |
195 foreach (node; s.children) | 195 foreach (stmnt; s.stmnts) |
196 visitS(cast(Statement)cast(void*)node); | 196 visitS(stmnt); |
197 //IllegalStatement has no subnodes. | 197 //IllegalStatement has no subnodes. |
198 static if (is(S == FuncBodyStatement)) | 198 static if (is(S == FuncBodyStatement)) |
199 s.funcBody && visitS(s.funcBody), | 199 s.funcBody && visitS(s.funcBody), |
200 s.inBody && visitS(s.inBody), | 200 s.inBody && visitS(s.inBody), |
201 s.outBody && visitS(s.outBody); | 201 s.outBody && visitS(s.outBody); |
263 static if (is(S == AsmBlockStatement)) | 263 static if (is(S == AsmBlockStatement)) |
264 visitS(s.statements); | 264 visitS(s.statements); |
265 static if (is(S == AsmStatement)) | 265 static if (is(S == AsmStatement)) |
266 foreach (op; s.operands) | 266 foreach (op; s.operands) |
267 visitE(op); | 267 visitE(op); |
268 //AsmAlignStatement has no subnodes. | 268 //AsmAlignStatement, |
269 //IllegalAsmStatement have no subnodes. | |
269 static if (is(S == PragmaStatement)) | 270 static if (is(S == PragmaStatement)) |
270 { | 271 { |
271 foreach (arg; s.args) | 272 foreach (arg; s.args) |
272 visitE(arg); | 273 visitE(arg); |
273 visitS(s.pragmaBody); | 274 visitS(s.pragmaBody); |
340 n.specValue && visitN(n.specValue), | 341 n.specValue && visitN(n.specValue), |
341 n.defValue && visitN(n.defValue); | 342 n.defValue && visitN(n.defValue); |
342 //TemplateTupleParameter has no subnodes. | 343 //TemplateTupleParameter has no subnodes. |
343 } | 344 } |
344 else | 345 else |
345 assert(0, "Missing default visit method for: "~t.classinfo.name); | 346 static assert(0, "Missing default visit method for: "~typeof(t).stringof); |
346 return t; | 347 return t; |
347 } | 348 } |
348 | 349 |
349 /// Generates the default visit methods. | 350 /// Generates the default visit methods. |
350 /// | 351 /// |