throw statement implementation

This commit is contained in:
LianaHus
2015-09-16 13:25:32 +02:00
parent 9d43f2c186
commit 279a36b6f8
14 changed files with 94 additions and 1 deletions
+10
View File
@@ -622,6 +622,16 @@ ASTPointer<Statement> Parser::parseStatement()
statement = nodeFactory.createNode<Return>(expression);
break;
}
case Token::Throw:
{
ASTNodeFactory nodeFactory(*this);
ASTPointer<Expression> expression;
if (m_scanner->next() != Token::Semicolon)
BOOST_THROW_EXCEPTION(createParserError("Throw statement cannot have parameters."));
statement = nodeFactory.createNode<Throw>(/*expression*/);
break;
}
case Token::Identifier:
if (m_insideModifier && m_scanner->currentLiteral() == "_")
{