diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 00:59:36 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 01:07:18 +0800 |
commit | 2067a00f2236980eeef812016ca923ec2cf3dbd2 (patch) | |
tree | cb65fe676c849e8d798f251db6474768f58c728c /libsolidity | |
parent | 5a71e4f1a7e856960d326be1743736cc04d3c238 (diff) | |
download | dexon-solidity-2067a00f2236980eeef812016ca923ec2cf3dbd2.tar.gz dexon-solidity-2067a00f2236980eeef812016ca923ec2cf3dbd2.tar.zst dexon-solidity-2067a00f2236980eeef812016ca923ec2cf3dbd2.zip |
Disallow private or internal functions in interfaces
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 87951003..3456958c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -463,6 +463,9 @@ bool TypeChecker::visit(FunctionDefinition const& _function) typeError(_function.location(), "Functions in interfaces cannot have an implementation."); _function.body().accept(*this); } + if (_function.visibility() < FunctionDefinition::Visibility::Public) + if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface) + typeError(_function.location(), "Functions in interfaces cannot be internal or private."); if (_function.isConstructor()) if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface) typeError(_function.location(), "Constructor cannot be defined in interfaces."); |