Fix --ast crash on empty 'for' init decl/statement

This commit is contained in:
eco 2013-08-16 19:52:18 -06:00
parent bace5f0a76
commit 77418c8ab7
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>");