mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Fixed a javascript return-else-statement parsing problem
This commit is contained in:
parent
606a503a15
commit
90ff2369e2
1 changed files with 11 additions and 1 deletions
|
|
@ -1079,7 +1079,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
if (matchIf (TokenTypes::while_)) return parseDoOrWhileLoop (false);
|
||||
if (matchIf (TokenTypes::do_)) return parseDoOrWhileLoop (true);
|
||||
if (matchIf (TokenTypes::for_)) return parseForLoop();
|
||||
if (matchIf (TokenTypes::return_)) return new ReturnStatement (location, matchIf (TokenTypes::semicolon) ? new Expression (location) : parseExpression());
|
||||
if (matchIf (TokenTypes::return_)) return parseReturn();
|
||||
if (matchIf (TokenTypes::break_)) return new BreakStatement (location);
|
||||
if (matchIf (TokenTypes::continue_)) return new ContinueStatement (location);
|
||||
if (matchIf (TokenTypes::function)) return parseFunction();
|
||||
|
|
@ -1111,6 +1111,16 @@ struct JavascriptEngine::RootObject : public DynamicObject
|
|||
return s.release();
|
||||
}
|
||||
|
||||
Statement* parseReturn()
|
||||
{
|
||||
if (matchIf (TokenTypes::semicolon))
|
||||
return new ReturnStatement (location, new Expression (location));
|
||||
|
||||
ReturnStatement* r = new ReturnStatement (location, parseExpression());
|
||||
matchIf (TokenTypes::semicolon);
|
||||
return r;
|
||||
}
|
||||
|
||||
Statement* parseVar()
|
||||
{
|
||||
ScopedPointer<VarStatement> s (new VarStatement (location));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue