Skip to content

Commit

Permalink
Set isConstructor to false unconditionally and update to true later f…
Browse files Browse the repository at this point in the history
…or constructors.
  • Loading branch information
ekpyron authored and axic committed Apr 3, 2018
1 parent e2dac9e commit 8f66390
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libsolidity/parsing/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 8f66390

Please sign in to comment.