This commit is contained in:
Hackerpilot 2014-04-24 14:21:16 -07:00
commit ae9ff77242
3 changed files with 10 additions and 3 deletions

View File

@ -592,6 +592,7 @@ class XMLPrinter : ASTVisitor
{
output.writeln("<gotoStatement>");
output.writeln("<case>");
if (gotoStatement.expression)
visit(gotoStatement.expression);
output.writeln("</case>");
output.writeln("</gotoStatement>");

View File

@ -2302,6 +2302,8 @@ public:
mixin (visitIfNotNull!(expression));
}
/** */ Expression expression;
/** */ size_t startLocation;
/** */ size_t endLocation;
mixin OpEquals;
}

View File

@ -4425,10 +4425,14 @@ q{(int a, ...)
{
mixin(traceEnterAndExit!(__FUNCTION__));
auto node = allocate!ReturnStatement;
if (expect(tok!"return") is null) return null;
auto start = expect(tok!"return");
if (start is null) return null;
node.startLocation = start.index;
if (!currentIs(tok!";"))
node.expression = parseExpression();
if (expect(tok!";") is null) return null;
auto semicolon = expect(tok!";");
if (semicolon is null) return null;
node.endLocation = semicolon.index;
return node;
}