mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added check for valid externalType to checkTypeRequirements for function
This commit is contained in:
parent
607f397234
commit
60204d593e
8
AST.cpp
8
AST.cpp
@ -305,8 +305,12 @@ TypePointer FunctionDefinition::getType(ContractDefinition const*) const
|
|||||||
void FunctionDefinition::checkTypeRequirements()
|
void FunctionDefinition::checkTypeRequirements()
|
||||||
{
|
{
|
||||||
for (ASTPointer<VariableDeclaration> const& var: getParameters() + getReturnParameters())
|
for (ASTPointer<VariableDeclaration> const& var: getParameters() + getReturnParameters())
|
||||||
|
{
|
||||||
if (!var->getType()->canLiveOutsideStorage())
|
if (!var->getType()->canLiveOutsideStorage())
|
||||||
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
|
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
|
||||||
|
if (!var->getType()->externalType() && getVisibility() >= Visibility::Internal)
|
||||||
|
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to have an external address."));
|
||||||
|
}
|
||||||
for (ASTPointer<ModifierInvocation> const& modifier: m_functionModifiers)
|
for (ASTPointer<ModifierInvocation> const& modifier: m_functionModifiers)
|
||||||
modifier->checkTypeRequirements(isConstructor() ?
|
modifier->checkTypeRequirements(isConstructor() ?
|
||||||
dynamic_cast<ContractDefinition const&>(*getScope()).getBaseContracts() :
|
dynamic_cast<ContractDefinition const&>(*getScope()).getBaseContracts() :
|
||||||
@ -653,6 +657,10 @@ void MemberAccess::checkTypeRequirements()
|
|||||||
if (!m_type)
|
if (!m_type)
|
||||||
BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found or not "
|
BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found or not "
|
||||||
"visible in " + type.toString()));
|
"visible in " + type.toString()));
|
||||||
|
//todo check for visibility
|
||||||
|
// else if (!m_type->externalType())
|
||||||
|
// BOOST_THROW_EXCEPTION(createTypeError("Type is required to have an external address."));
|
||||||
|
|
||||||
// This should probably move somewhere else.
|
// This should probably move somewhere else.
|
||||||
if (type.getCategory() == Type::Category::Struct)
|
if (type.getCategory() == Type::Category::Struct)
|
||||||
m_isLValue = true;
|
m_isLValue = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user