Merge pull request #46 from eco/empty-for-init

Fix --ast crash on empty 'for' init decl/statement
This commit is contained in:
Hackerpilot 2013-08-16 21:11:19 -07:00
commit 2cc5152a68
1 changed files with 6 additions and 3 deletions

View File

@ -464,9 +464,12 @@ class XMLPrinter : ASTVisitor
override void visit(ForStatement forStatement)
{
output.writeln("<forStatement>");
output.writeln("<initialize>");
visit(forStatement.declarationOrStatement);
output.writeln("</initialize>");
if (forStatement.declarationOrStatement !is null)
{
output.writeln("<initialize>");
visit(forStatement.declarationOrStatement);
output.writeln("</initialize>");
}
if (forStatement.test !is null)
{
output.writeln("<test>");