aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-15 20:22:50 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-14 22:58:04 +0800
commit5b5367dc1237634886a8ccf1029d95b83a0d8e63 (patch)
tree517f18eb028060f64efd424a8b0560e07e14f3c6 /libsolidity/analysis
parent1c85ba10e13879f680579031234c911099433596 (diff)
downloaddexon-solidity-5b5367dc1237634886a8ccf1029d95b83a0d8e63.tar.gz
dexon-solidity-5b5367dc1237634886a8ccf1029d95b83a0d8e63.tar.zst
dexon-solidity-5b5367dc1237634886a8ccf1029d95b83a0d8e63.zip
Warn if no visibility is specified on contract functions.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp14
-rw-r--r--libsolidity/analysis/SyntaxChecker.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp
index d2571cd3..187eb26f 100644
--- a/libsolidity/analysis/SyntaxChecker.cpp
+++ b/libsolidity/analysis/SyntaxChecker.cpp
@@ -138,7 +138,7 @@ bool SyntaxChecker::visit(WhileStatement const&)
return true;
}
-void SyntaxChecker::endVisit(WhileStatement const& )
+void SyntaxChecker::endVisit(WhileStatement const&)
{
m_inLoopDepth--;
}
@@ -193,6 +193,18 @@ bool SyntaxChecker::visit(PlaceholderStatement const&)
return true;
}
+bool SyntaxChecker::visit(FunctionDefinition const& _function)
+{
+ if (_function.noVisibilitySpecified())
+ m_errorReporter.warning(
+ _function.location(),
+ "No visibility specified. Defaulting to \"" +
+ Declaration::visibilityToString(_function.visibility()) +
+ "\"."
+ );
+ return true;
+}
+
bool SyntaxChecker::visit(FunctionTypeName const& _node)
{
for (auto const& decl: _node.parameterTypeList()->parameters())
diff --git a/libsolidity/analysis/SyntaxChecker.h b/libsolidity/analysis/SyntaxChecker.h
index fa34bab3..7fffbec0 100644
--- a/libsolidity/analysis/SyntaxChecker.h
+++ b/libsolidity/analysis/SyntaxChecker.h
@@ -66,6 +66,7 @@ private:
virtual bool visit(PlaceholderStatement const& _placeholderStatement) override;
+ virtual bool visit(FunctionDefinition const& _function) override;
virtual bool visit(FunctionTypeName const& _node) override;
ErrorReporter& m_errorReporter;