Makes visibility warning more concise.

This commit is contained in:
Erik Kundt 2018-03-28 18:10:32 +02:00
parent 601659c384
commit f9efa41749
2 changed files with 5 additions and 3 deletions

View File

@ -51,12 +51,14 @@ void StaticAnalyzer::endVisit(ContractDefinition const&)
bool StaticAnalyzer::visit(FunctionDefinition const& _function)
{
const bool isInterface = m_currentContract->contractKind() == ContractDefinition::ContractKind::Interface;
if (_function.noVisibilitySpecified())
m_errorReporter.warning(
_function.location(),
"No visibility specified. Defaulting to \"" +
(isInterface ? "external" : Declaration::visibilityToString(_function.visibility())) +
"\"."
Declaration::visibilityToString(_function.visibility()) +
"\". " +
(isInterface ? "In interfaces it defaults to external." : "")
);
if (_function.isImplemented())
m_currentFunction = &_function;

View File

@ -3,4 +3,4 @@ interface I {
}
// ----
// Warning: Functions in interfaces should be declared external.
// Warning: No visibility specified. Defaulting to "external".
// Warning: No visibility specified. Defaulting to "public". In interfaces it defaults to external.