aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}