aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-03-18 00:37:02 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-03-18 01:06:52 +0800
commitd5102c1db7cd2334e127ff684a6ecdd6aff156c6 (patch)
treee083e24cc36d0199e7c03d27c8d2f62265a4b2af /libsolidity
parent2c4bce2d62dc8bfc752858db12c625aec6e5960f (diff)
downloaddexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar.gz
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar.bz2
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar.lz
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar.xz
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.tar.zst
dexon-solidity-d5102c1db7cd2334e127ff684a6ecdd6aff156c6.zip
Disallow constructor in interfaces
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 3dffecdb..87951003 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.isConstructor())
+ if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface)
+ typeError(_function.location(), "Constructor cannot be defined in interfaces.");
return false;
}