Merge pull request #3613 from ethereum/require-visibility

Issue error if no visibility is specified (on 0.5.0)
This commit is contained in:
chriseth
2018-02-28 16:33:39 +01:00
committed by GitHub
4 changed files with 38 additions and 13 deletions
+13 -6
View File
@@ -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;
}