diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-27 22:21:23 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-27 23:31:53 +0800 |
commit | a566825589a2c0d41e2e136527b98737cffb5701 (patch) | |
tree | 4876d2559efdd02d11ba169dcd53801e4f981bf6 /libsolidity/analysis | |
parent | 2abc5be7e628c18562f1df546137fcb0748ecbb2 (diff) | |
download | dexon-solidity-a566825589a2c0d41e2e136527b98737cffb5701.tar.gz dexon-solidity-a566825589a2c0d41e2e136527b98737cffb5701.tar.zst dexon-solidity-a566825589a2c0d41e2e136527b98737cffb5701.zip |
Issue error if no visibility is specified (on 0.5.0)
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/SyntaxChecker.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 1dcfeb27..ddac194b 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -212,13 +212,20 @@ bool SyntaxChecker::visit(PlaceholderStatement const&) bool SyntaxChecker::visit(FunctionDefinition const& _function) { + bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050); + if (_function.noVisibilitySpecified()) - m_errorReporter.warning( - _function.location(), - "No visibility specified. Defaulting to \"" + - Declaration::visibilityToString(_function.visibility()) + - "\"." - ); + { + if (v050) + m_errorReporter.syntaxError(_function.location(), "No visibility specified."); + else + m_errorReporter.warning( + _function.location(), + "No visibility specified. Defaulting to \"" + + Declaration::visibilityToString(_function.visibility()) + + "\"." + ); + } return true; } |