diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-08 06:11:50 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 00:27:04 +0800 |
commit | 6d4628ace4082a4318dc61fff49e8d193eea36e9 (patch) | |
tree | 285b3de14bf249fd5955682bbe4dcf03eab4e18c /libsolidity/ast/AST.h | |
parent | c37397c17871591bb897ca6f390a315f2ad0b030 (diff) | |
download | dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar.gz dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar.bz2 dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar.lz dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar.xz dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.tar.zst dexon-solidity-6d4628ace4082a4318dc61fff49e8d193eea36e9.zip |
Add ContractKind to ContractDefinition
Diffstat (limited to 'libsolidity/ast/AST.h')
-rw-r--r-- | libsolidity/ast/AST.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 8031760d..02234ffc 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -316,19 +316,21 @@ protected: class ContractDefinition: public Declaration, public Documented { public: + enum class ContractKind { Interface, Contract, Library }; + ContractDefinition( SourceLocation const& _location, ASTPointer<ASTString> const& _name, ASTPointer<ASTString> const& _documentation, std::vector<ASTPointer<InheritanceSpecifier>> const& _baseContracts, std::vector<ASTPointer<ASTNode>> const& _subNodes, - bool _isLibrary + ContractKind _contractKind = ContractKind::Contract ): Declaration(_location, _name), Documented(_documentation), m_baseContracts(_baseContracts), m_subNodes(_subNodes), - m_isLibrary(_isLibrary) + m_contractKind(_contractKind) {} virtual void accept(ASTVisitor& _visitor) override; @@ -344,7 +346,7 @@ public: std::vector<FunctionDefinition const*> definedFunctions() const { return filteredNodes<FunctionDefinition>(m_subNodes); } std::vector<EventDefinition const*> events() const { return filteredNodes<EventDefinition>(m_subNodes); } std::vector<EventDefinition const*> const& interfaceEvents() const; - bool isLibrary() const { return m_isLibrary; } + bool isLibrary() const { return m_contractKind == ContractKind::Library; } /// @returns a map of canonical function signatures to FunctionDefinitions /// as intended for use by the ABI. @@ -371,10 +373,12 @@ public: virtual ContractDefinitionAnnotation& annotation() const override; + ContractKind contractKind() const { return m_contractKind; } + private: std::vector<ASTPointer<InheritanceSpecifier>> m_baseContracts; std::vector<ASTPointer<ASTNode>> m_subNodes; - bool m_isLibrary; + ContractKind m_contractKind; // parsed Natspec documentation of the contract. Json::Value m_userDocumentation; |