aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Parser.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-16 18:02:35 +0800
committerchriseth <chris@ethereum.org>2018-04-12 04:00:04 +0800
commit6d289783b41109b445fec924354580a79b65a94a (patch)
treee9021d42d24a19a4d8cbee93d37050beddf3b24f /libsolidity/parsing/Parser.cpp
parent08e807aea01a443419dc82e159776899d96441ec (diff)
downloaddexon-solidity-6d289783b41109b445fec924354580a79b65a94a.tar.gz
dexon-solidity-6d289783b41109b445fec924354580a79b65a94a.tar.zst
dexon-solidity-6d289783b41109b445fec924354580a79b65a94a.zip
Fix state variable parsing.
Diffstat (limited to 'libsolidity/parsing/Parser.cpp')
-rw-r--r--libsolidity/parsing/Parser.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 18ef740a..bdb46ad6 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -380,6 +380,14 @@ Parser::FunctionHeaderParserResult Parser::parseFunctionHeader(
{
if (result.visibility != Declaration::Visibility::Default)
{
+ // There is the special case of a public state variable of function type.
+ // Detect this and return early.
+ if (
+ (result.visibility == Declaration::Visibility::External || result.visibility == Declaration::Visibility::Internal) &&
+ result.modifiers.empty() &&
+ result.name->empty()
+ )
+ break;
parserError(string(
"Visibility already specified as \"" +
Declaration::visibilityToString(result.visibility) +