From abc24420a7837557e5160db8af83ea3be5a371c3 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Tue, 10 Jan 2017 18:55:36 +0100 Subject: [PATCH] ast: events have FunctionType too --- libsolidity/ast/AST.cpp | 18 +++++++++++++----- libsolidity/ast/AST.h | 7 ++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index ac92eaa32..6f7a64dcb 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -274,7 +274,7 @@ TypeDeclarationAnnotation& EnumDefinition::annotation() const return static_cast(*m_annotation); } -shared_ptr FunctionDefinition::functionType(bool _internal) const +shared_ptr FunctionDefinition::functionType(bool _internal) const { if (_internal) { @@ -285,7 +285,7 @@ shared_ptr FunctionDefinition::functionType(bool _internal) case Declaration::Visibility::Private: case Declaration::Visibility::Internal: case Declaration::Visibility::Public: - return make_shared(*this, _internal); + return make_shared(*this, _internal); case Declaration::Visibility::External: return {}; default: @@ -303,7 +303,7 @@ shared_ptr FunctionDefinition::functionType(bool _internal) return {}; case Declaration::Visibility::Public: case Declaration::Visibility::External: - return make_shared(*this, _internal); + return make_shared(*this, _internal); default: solAssert(false, "visibility() should not return a Visibility"); } @@ -347,6 +347,14 @@ TypePointer EventDefinition::type() const return make_shared(*this); } +std::shared_ptr EventDefinition::functionType(bool _internal) const +{ + if (_internal) + return make_shared(*this); + else + return {}; +} + EventDefinitionAnnotation& EventDefinition::annotation() const { if (!m_annotation) @@ -404,7 +412,7 @@ TypePointer VariableDeclaration::type() const return annotation().type; } -shared_ptr VariableDeclaration::functionType(bool _internal) const +shared_ptr VariableDeclaration::functionType(bool _internal) const { if (_internal) return {}; @@ -417,7 +425,7 @@ shared_ptr VariableDeclaration::functionType(bool _internal) return {}; case Declaration::Visibility::Public: case Declaration::Visibility::External: - return make_shared(*this); + return make_shared(*this); default: solAssert(false, "visibility() should not return a Visibility"); } diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 088d68dbe..2d0924089 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -173,7 +173,7 @@ public: /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @returns null when it is not accessible as a function. - virtual std::shared_ptr functionType(bool /*_internal*/) const { return {}; } + virtual std::shared_ptr functionType(bool /*_internal*/) const { return {}; } protected: virtual Visibility defaultVisibility() const { return Visibility::Public; } @@ -587,7 +587,7 @@ public: /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @returns null when it is not accessible as a function. - virtual std::shared_ptr functionType(bool /*_internal*/) const override; + virtual std::shared_ptr functionType(bool /*_internal*/) const override; virtual FunctionDefinitionAnnotation& annotation() const override; @@ -653,7 +653,7 @@ public: /// @param _internal false indicates external interface is concerned, true indicates internal interface is concerned. /// @returns null when it is not accessible as a function. - virtual std::shared_ptr functionType(bool /*_internal*/) const override; + virtual std::shared_ptr functionType(bool /*_internal*/) const override; virtual VariableDeclarationAnnotation& annotation() const override; @@ -752,6 +752,7 @@ public: bool isAnonymous() const { return m_anonymous; } virtual TypePointer type() const override; + virtual std::shared_ptr functionType(bool /*_internal*/) const override; virtual EventDefinitionAnnotation& annotation() const override;