diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-16 06:12:31 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 01:06:52 +0800 |
commit | 2c4bce2d62dc8bfc752858db12c625aec6e5960f (patch) | |
tree | 2899876e56f303de00c637ce3e82f37fb004ebef /libsolidity | |
parent | 16a91ef90aaf589361e34a10dcee2181ba6cb2ed (diff) | |
download | dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar.gz dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar.bz2 dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar.lz dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar.xz dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.tar.zst dexon-solidity-2c4bce2d62dc8bfc752858db12c625aec6e5960f.zip |
Disallow enums in interfaces
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 7 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index f6e4d6c8..3dffecdb 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -517,6 +517,13 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) return false; } +bool TypeChecker::visit(EnumDefinition const& _enum) +{ + if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface) + typeError(_enum.location(), "Enumerable cannot be declared in interfaces."); + return false; +} + void TypeChecker::visitManually( ModifierInvocation const& _modifier, vector<ContractDefinition const*> const& _bases diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h index 46d8230a..88559f44 100644 --- a/libsolidity/analysis/TypeChecker.h +++ b/libsolidity/analysis/TypeChecker.h @@ -83,6 +83,7 @@ private: virtual bool visit(StructDefinition const& _struct) override; virtual bool visit(FunctionDefinition const& _function) override; virtual bool visit(VariableDeclaration const& _variable) override; + virtual bool visit(EnumDefinition const& _enum) override; /// We need to do this manually because we want to pass the bases of the current contract in /// case this is a base constructor call. void visitManually(ModifierInvocation const& _modifier, std::vector<ContractDefinition const*> const& _bases); |