diff options
author | chriseth <chris@ethereum.org> | 2018-02-28 23:33:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-28 23:33:39 +0800 |
commit | 22d26e059c46274d572403a9528cd24e8d4de867 (patch) | |
tree | ef2e58c033f0ccc1e7c3976a7fe2b000e071741c /libsolidity | |
parent | ac5485a25406ea5274e6c07290d21c3571a71a6e (diff) | |
parent | a566825589a2c0d41e2e136527b98737cffb5701 (diff) | |
download | dexon-solidity-22d26e059c46274d572403a9528cd24e8d4de867.tar.gz dexon-solidity-22d26e059c46274d572403a9528cd24e8d4de867.tar.zst dexon-solidity-22d26e059c46274d572403a9528cd24e8d4de867.zip |
Merge pull request #3613 from ethereum/require-visibility
Issue error if no visibility is specified (on 0.5.0)
Diffstat (limited to 'libsolidity')
-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; } |