aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-28 03:55:55 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-28 04:52:57 +0800
commit9fc6eccc26eea6f5a70f2960df9d53d49392151e (patch)
tree8dd67fc01a6abaecffbac1d100fe550c8e088616 /libsolidity/ast
parent53f747b7ded3610802582448257b25e87442bebb (diff)
downloaddexon-solidity-9fc6eccc26eea6f5a70f2960df9d53d49392151e.tar.gz
dexon-solidity-9fc6eccc26eea6f5a70f2960df9d53d49392151e.tar.zst
dexon-solidity-9fc6eccc26eea6f5a70f2960df9d53d49392151e.zip
Add isFallback() helper
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/AST.cpp2
-rw-r--r--libsolidity/ast/AST.h5
2 files changed, 4 insertions, 3 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index ebc8bd48..1d68231e 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -162,7 +162,7 @@ FunctionDefinition const* ContractDefinition::fallbackFunction() const
{
for (ContractDefinition const* contract: annotation().linearizedBaseContracts)
for (FunctionDefinition const* f: contract->definedFunctions())
- if (f->name().empty())
+ if (f->isFallback())
return f;
return nullptr;
}
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index e4656f72..3e97286b 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -589,6 +589,7 @@ public:
virtual void accept(ASTConstVisitor& _visitor) const override;
bool isConstructor() const { return m_isConstructor; }
+ bool isFallback() const { return name().empty(); }
bool isDeclaredConst() const { return m_isDeclaredConst; }
bool isPayable() const { return m_isPayable; }
std::vector<ASTPointer<ModifierInvocation>> const& modifiers() const { return m_functionModifiers; }
@@ -596,9 +597,9 @@ public:
Block const& body() const { solAssert(m_body, ""); return *m_body; }
virtual bool isVisibleInContract() const override
{
- return Declaration::isVisibleInContract() && !isConstructor() && !name().empty();
+ return Declaration::isVisibleInContract() && !isConstructor() && !isFallback();
}
- virtual bool isPartOfExternalInterface() const override { return isPublic() && !m_isConstructor && !name().empty(); }
+ virtual bool isPartOfExternalInterface() const override { return isPublic() && !isConstructor() && !isFallback(); }
/// @returns the external signature of the function
/// That consists of the name of the function followed by the types of the