diff options
author | chriseth <chris@ethereum.org> | 2018-04-13 03:01:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 03:01:08 +0800 |
commit | 7054defdd6c202d0943c11cb87ac2748b9bdc62b (patch) | |
tree | 8a69eb34b9089b689d5f467b8cb56b4a74ad04b8 /libsolidity/ast | |
parent | 44416d1ac65b2cfae4bb15d39bc84b1a78211baa (diff) | |
parent | 966367305ad511900bedfd9af08114a0b1307399 (diff) | |
download | dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar.gz dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar.bz2 dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar.lz dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar.xz dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.tar.zst dexon-solidity-7054defdd6c202d0943c11cb87ac2748b9bdc62b.zip |
Merge pull request #3364 from ethereum/revertWithReason
Revert with reason
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/AST.cpp | 7 | ||||
-rw-r--r-- | libsolidity/ast/AST.h | 13 |
2 files changed, 13 insertions, 7 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index d8ad009d..80f5d642 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -297,7 +297,7 @@ ContractDefinition::ContractKind FunctionDefinition::inContractKind() const return contractDef->contractKind(); } -shared_ptr<FunctionType> FunctionDefinition::functionType(bool _internal) const +FunctionTypePointer FunctionDefinition::functionType(bool _internal) const { if (_internal) { @@ -338,6 +338,7 @@ shared_ptr<FunctionType> FunctionDefinition::functionType(bool _internal) const TypePointer FunctionDefinition::type() const { + solAssert(visibility() != Declaration::Visibility::External, ""); return make_shared<FunctionType>(*this); } @@ -379,7 +380,7 @@ TypePointer EventDefinition::type() const return make_shared<FunctionType>(*this); } -std::shared_ptr<FunctionType> EventDefinition::functionType(bool _internal) const +FunctionTypePointer EventDefinition::functionType(bool _internal) const { if (_internal) return make_shared<FunctionType>(*this); @@ -484,7 +485,7 @@ TypePointer VariableDeclaration::type() const return annotation().type; } -shared_ptr<FunctionType> VariableDeclaration::functionType(bool _internal) const +FunctionTypePointer VariableDeclaration::functionType(bool _internal) const { if (_internal) return {}; diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index ae253f0c..a53987bf 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -218,7 +218,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> functionType(bool /*_internal*/) const { return {}; } + virtual FunctionTypePointer functionType(bool /*_internal*/) const { return {}; } protected: virtual Visibility defaultVisibility() const { return Visibility::Public; } @@ -634,7 +634,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> functionType(bool /*_internal*/) const override; + virtual FunctionTypePointer functionType(bool /*_internal*/) const override; virtual FunctionDefinitionAnnotation& annotation() const override; @@ -703,7 +703,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> functionType(bool /*_internal*/) const override; + virtual FunctionTypePointer functionType(bool /*_internal*/) const override; virtual VariableDeclarationAnnotation& annotation() const override; @@ -805,7 +805,7 @@ public: bool isAnonymous() const { return m_anonymous; } virtual TypePointer type() const override; - virtual std::shared_ptr<FunctionType> functionType(bool /*_internal*/) const override; + virtual FunctionTypePointer functionType(bool /*_internal*/) const override; virtual EventDefinitionAnnotation& annotation() const override; @@ -831,6 +831,11 @@ public: solAssert(false, "MagicVariableDeclaration used inside real AST."); } + virtual FunctionTypePointer functionType(bool) const override + { + solAssert(m_type->category() == Type::Category::Function, ""); + return std::dynamic_pointer_cast<FunctionType const>(m_type); + } virtual TypePointer type() const override { return m_type; } private: |