Set isConstructor to false unconditionally and update to true later for constructors.

This commit is contained in:
Daniel Kirchner 2018-03-09 14:23:48 +01:00 committed by Alex Beregszaszi
parent e2dac9ed39
commit 8f66390f56

View File

@ -341,13 +341,11 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(
RecursionGuard recursionGuard(*this);
FunctionHeaderParserResult result;
if (m_scanner->currentToken() == Token::Function)
// In case of old style constructors, i.e. functions with the same name as the contract,
// this is set to true below.
result.isConstructor = false;
else if (m_scanner->currentToken() == Token::Identifier && m_scanner->currentLiteral() == "constructor")
result.isConstructor = false;
if (m_scanner->currentToken() == Token::Identifier && m_scanner->currentLiteral() == "constructor")
result.isConstructor = true;
else
else if (m_scanner->currentToken() != Token::Function)
solAssert(false, "Function or constructor expected.");
m_scanner->next();