Merge pull request #166 from liranz/master
Small fix for goto case and addition to ReturnStatement
This commit is contained in:
commit
13534ef605
|
@ -592,6 +592,7 @@ class XMLPrinter : ASTVisitor
|
||||||
{
|
{
|
||||||
output.writeln("<gotoStatement>");
|
output.writeln("<gotoStatement>");
|
||||||
output.writeln("<case>");
|
output.writeln("<case>");
|
||||||
|
if (gotoStatement.expression)
|
||||||
visit(gotoStatement.expression);
|
visit(gotoStatement.expression);
|
||||||
output.writeln("</case>");
|
output.writeln("</case>");
|
||||||
output.writeln("</gotoStatement>");
|
output.writeln("</gotoStatement>");
|
||||||
|
|
|
@ -2302,6 +2302,8 @@ public:
|
||||||
mixin (visitIfNotNull!(expression));
|
mixin (visitIfNotNull!(expression));
|
||||||
}
|
}
|
||||||
/** */ Expression expression;
|
/** */ Expression expression;
|
||||||
|
/** */ size_t startLocation;
|
||||||
|
/** */ size_t endLocation;
|
||||||
mixin OpEquals;
|
mixin OpEquals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4425,10 +4425,14 @@ q{(int a, ...)
|
||||||
{
|
{
|
||||||
mixin(traceEnterAndExit!(__FUNCTION__));
|
mixin(traceEnterAndExit!(__FUNCTION__));
|
||||||
auto node = allocate!ReturnStatement;
|
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!";"))
|
if (!currentIs(tok!";"))
|
||||||
node.expression = parseExpression();
|
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;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue