aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-03-09 21:23:48 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-04-04 00:21:55 +0800
commit8f66390f56c866f70ab6617dac1f0713ace2d7ff (patch)
tree471dbf1e9a5ceab4f7a1d1fc14d0c86ad449e046
parente2dac9ed397c29bfe426912c28ef2d419b2324c8 (diff)
downloaddexon-solidity-8f66390f56c866f70ab6617dac1f0713ace2d7ff.tar.gz
dexon-solidity-8f66390f56c866f70ab6617dac1f0713ace2d7ff.tar.zst
dexon-solidity-8f66390f56c866f70ab6617dac1f0713ace2d7ff.zip
Set isConstructor to false unconditionally and update to true later for constructors.
-rw-r--r--libsolidity/parsing/Parser.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 6ae66eee..3dbd4c8f 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -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();