diff options
author | chriseth <c@ethdev.com> | 2016-11-11 22:23:50 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:19 +0800 |
commit | 7a292c9a05eb38f10f6e619db0805105433fda30 (patch) | |
tree | 5d230d23d78b574c0783f42c41a7a76abdc88506 /libsolidity | |
parent | 0335ed4cb476ece63224a96c8ab660116ff08c3a (diff) | |
download | dexon-solidity-7a292c9a05eb38f10f6e619db0805105433fda30.tar.gz dexon-solidity-7a292c9a05eb38f10f6e619db0805105433fda30.tar.zst dexon-solidity-7a292c9a05eb38f10f6e619db0805105433fda30.zip |
Fix parser for function type disambiguity.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index e844861b..02b7d5e0 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -315,7 +315,18 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(bool _forceEmptyN m_scanner->next(); } else if (_allowModifiers && token == Token::Identifier) - result.modifiers.push_back(parseModifierInvocation()); + { + // This can either be a modifier (function declaration) or the name of the + // variable (function type name plus variable). + if ( + m_scanner->peekNextToken() == Token::Semicolon || + m_scanner->peekNextToken() == Token::Assign + ) + // Variable declaration, break here. + break; + else + result.modifiers.push_back(parseModifierInvocation()); + } else if (Token::isVisibilitySpecifier(token)) { if (result.visibility != Declaration::Visibility::Default) |