aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-03-14 23:56:06 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-03-26 18:37:38 +0800
commit8bae2dba7c9697d129a43c1dde54690f3e37a84a (patch)
tree07ce21a7b1ff6d0171e231249f1b7df837734d31 /libsolidity/ast
parentef3595b0001614c19174c61d29d221844ed83a0e (diff)
downloaddexon-solidity-8bae2dba7c9697d129a43c1dde54690f3e37a84a.tar.gz
dexon-solidity-8bae2dba7c9697d129a43c1dde54690f3e37a84a.tar.zst
dexon-solidity-8bae2dba7c9697d129a43c1dde54690f3e37a84a.zip
Introduce inContractKind helper on FunctionDefinition
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/AST.cpp7
-rw-r--r--libsolidity/ast/AST.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 27220b1f..d8ad009d 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -290,6 +290,13 @@ TypeDeclarationAnnotation& EnumDefinition::annotation() const
return dynamic_cast<TypeDeclarationAnnotation&>(*m_annotation);
}
+ContractDefinition::ContractKind FunctionDefinition::inContractKind() const
+{
+ auto contractDef = dynamic_cast<ContractDefinition const*>(scope());
+ solAssert(contractDef, "Enclosing Scope of FunctionDefinition was not set.");
+ return contractDef->contractKind();
+}
+
shared_ptr<FunctionType> FunctionDefinition::functionType(bool _internal) const
{
if (_internal)
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index a25df64b..9c67d354 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -624,6 +624,8 @@ public:
/// arguments separated by commas all enclosed in parentheses without any spaces.
std::string externalSignature() const;
+ ContractDefinition::ContractKind inContractKind() const;
+
virtual TypePointer type() const override;
/// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned.