Warn deprecated usage of parameter names in function types

This commit is contained in:
Federico Bond
2017-06-26 15:39:01 -03:00
parent bffb8c404f
commit 70fd5c1770
4 changed files with 36 additions and 2 deletions
+12
View File
@@ -148,3 +148,15 @@ bool SyntaxChecker::visit(PlaceholderStatement const&)
return true;
}
bool SyntaxChecker::visit(FunctionTypeName const& _node)
{
for (auto const& decl: _node.parameterTypeList()->parameters())
if (!decl->name().empty())
m_errorReporter.warning(decl->location(), "Naming function type parameters is deprecated.");
for (auto const& decl: _node.returnParameterTypeList()->parameters())
if (!decl->name().empty())
m_errorReporter.warning(decl->location(), "Naming function type return parameters is deprecated.");
return true;
}
+2
View File
@@ -63,6 +63,8 @@ private:
virtual bool visit(PlaceholderStatement const& _placeholderStatement) override;
virtual bool visit(FunctionTypeName const& _node) override;
ErrorReporter& m_errorReporter;
/// Flag that indicates whether a function modifier actually contains '_'.