aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-03-18 01:01:13 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-03-18 01:07:20 +0800
commit96c09fcbcd21ed6b907e055c915d5f13814b87d5 (patch)
treeb600c78e319167170f4e9941d00c68e7f24dab0e /libsolidity/analysis
parent2067a00f2236980eeef812016ca923ec2cf3dbd2 (diff)
downloaddexon-solidity-96c09fcbcd21ed6b907e055c915d5f13814b87d5.tar.gz
dexon-solidity-96c09fcbcd21ed6b907e055c915d5f13814b87d5.tar.zst
dexon-solidity-96c09fcbcd21ed6b907e055c915d5f13814b87d5.zip
Simplify interface checks for FunctionDefinition
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 3456958c..b0551fcb 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -457,18 +457,17 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
dynamic_cast<ContractDefinition const&>(*_function.scope()).annotation().linearizedBaseContracts :
vector<ContractDefinition const*>()
);
- if (_function.isImplemented())
+ if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
{
- if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
+ if (_function.isImplemented())
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)
+ if (_function.visibility() < FunctionDefinition::Visibility::Public)
typeError(_function.location(), "Functions in interfaces cannot be internal or private.");
- if (_function.isConstructor())
- if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
+ if (_function.isConstructor())
typeError(_function.location(), "Constructor cannot be defined in interfaces.");
+ }
+ if (_function.isImplemented())
+ _function.body().accept(*this);
return false;
}