mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow memory types containing mappings.
This commit is contained in:
parent
03edf74e62
commit
fac8124412
11
AST.cpp
11
AST.cpp
@ -535,7 +535,16 @@ void VariableDeclaration::checkTypeRequirements()
|
|||||||
BOOST_THROW_EXCEPTION(createTypeError("Variable cannot have void type."));
|
BOOST_THROW_EXCEPTION(createTypeError("Variable cannot have void type."));
|
||||||
m_type = type->mobileType();
|
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."));
|
BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
Types.h
1
Types.h
@ -449,6 +449,7 @@ public:
|
|||||||
virtual unsigned getCalldataEncodedSize(bool _padded) const override;
|
virtual unsigned getCalldataEncodedSize(bool _padded) const override;
|
||||||
virtual bool isDynamicallySized() const override { return m_hasDynamicLength; }
|
virtual bool isDynamicallySized() const override { return m_hasDynamicLength; }
|
||||||
virtual u256 getStorageSize() const override;
|
virtual u256 getStorageSize() const override;
|
||||||
|
virtual bool canLiveOutsideStorage() const override { return m_baseType->canLiveOutsideStorage(); }
|
||||||
virtual unsigned getSizeOnStack() const override;
|
virtual unsigned getSizeOnStack() const override;
|
||||||
virtual std::string toString(bool _short) const override;
|
virtual std::string toString(bool _short) const override;
|
||||||
virtual MemberList const& getMembers() const override
|
virtual MemberList const& getMembers() const override
|
||||||
|
Loading…
Reference in New Issue
Block a user