diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-03-09 21:23:48 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-04 00:21:55 +0800 |
commit | 8f66390f56c866f70ab6617dac1f0713ace2d7ff (patch) | |
tree | 471dbf1e9a5ceab4f7a1d1fc14d0c86ad449e046 /libsolidity/parsing | |
parent | e2dac9ed397c29bfe426912c28ef2d419b2324c8 (diff) | |
download | dexon-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.
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 10 |
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(); |