aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/SyntaxChecker.cpp14
-rw-r--r--libsolidity/analysis/SyntaxChecker.h1
-rw-r--r--libsolidity/ast/AST.h1
3 files changed, 15 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;
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index cecc2f04..75b8e946 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -180,6 +180,7 @@ public:
/// @returns the declared name.
ASTString const& name() const { return *m_name; }
+ bool noVisibilitySpecified() const { return m_visibility == Visibility::Default; }
Visibility visibility() const { return m_visibility == Visibility::Default ? defaultVisibility() : m_visibility; }
bool isPublic() const { return visibility() >= Visibility::Public; }
virtual bool isVisibleInContract() const { return visibility() != Visibility::External; }