Issue error if no visibility is specified (on 0.5.0)

This commit is contained in:
Alex Beregszaszi
2018-02-27 16:31:53 +01:00
parent 2abc5be7e6
commit a566825589
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;
}