Merge pull request #2416 from federicobond/multiple-specifiers

Display error if payable or constant is specified multiple times
This commit is contained in:
chriseth
2017-06-19 12:00:04 +02:00
committed by GitHub
2 changed files with 24 additions and 0 deletions
+6
View File
@@ -323,11 +323,17 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN
Token::Value token = m_scanner->currentToken();
if (token == Token::Const)
{
if (result.isDeclaredConst)
parserError(string("Multiple \"constant\" specifiers."));
result.isDeclaredConst = true;
m_scanner->next();
}
else if (m_scanner->currentToken() == Token::Payable)
{
if (result.isPayable)
parserError(string("Multiple \"payable\" specifiers."));
result.isPayable = true;
m_scanner->next();
}