diff options
author | chriseth <c@ethdev.com> | 2015-06-27 03:27:53 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-27 03:28:02 +0800 |
commit | fac812441215f4721f5e0a2b3d79d358a085a101 (patch) | |
tree | 4315a81c2e3479724cf7287572f84d2e0ea9719c /AST.cpp | |
parent | 03edf74e62f8dde537c8d3f956c6cc0a5e823e6b (diff) | |
download | dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar.gz dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar.bz2 dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar.lz dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar.xz dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.tar.zst dexon-solidity-fac812441215f4721f5e0a2b3d79d358a085a101.zip |
Disallow memory types containing mappings.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -535,7 +535,16 @@ void VariableDeclaration::checkTypeRequirements() BOOST_THROW_EXCEPTION(createTypeError("Variable cannot have void type.")); m_type = type->mobileType(); } - if (m_isStateVariable && getVisibility() >= Visibility::Public && !FunctionType(*this).externalType()) + solAssert(!!m_type, ""); + if (!m_isStateVariable) + { + if (m_type->dataStoredIn(DataLocation::Memory) || m_type->dataStoredIn(DataLocation::CallData)) + if (!m_type->canLiveOutsideStorage()) + BOOST_THROW_EXCEPTION(createTypeError( + "Type " + m_type->toString() + " is only valid in storage." + )); + } + else if (getVisibility() >= Visibility::Public && !FunctionType(*this).externalType()) BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); } |