From 2ad1acaf721072d27783d586048d6377be6c3f99 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 16 Mar 2018 12:39:30 +0100 Subject: Warn if modifiers are applied to functions without implementation. --- libsolidity/analysis/SyntaxChecker.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 343b4ba8..f648e5b4 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -232,6 +232,13 @@ bool SyntaxChecker::visit(FunctionDefinition const& _function) "Use \"constructor(...) { ... }\" instead." ); } + if (!_function.isImplemented() && !_function.modifiers().empty()) + { + if (v050) + m_errorReporter.syntaxError(_function.location(), "Functions without implementation cannot have modifiers."); + else + m_errorReporter.warning( _function.location(), "Modifiers of functions without implementation are ignored." ); + } return true; } -- cgit