diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-03-20 00:33:10 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-03-25 20:59:39 +0800 |
commit | 60204d593e48d2f4395a34c3e7bb010d4f40e513 (patch) | |
tree | 0c5c17306fe5790032829b845bc5d3d661b6934b /AST.cpp | |
parent | 607f3972349a17b9d06aca0ce733789f16f573c1 (diff) | |
download | dexon-solidity-60204d593e48d2f4395a34c3e7bb010d4f40e513.tar.gz dexon-solidity-60204d593e48d2f4395a34c3e7bb010d4f40e513.tar.zst dexon-solidity-60204d593e48d2f4395a34c3e7bb010d4f40e513.zip |
added check for valid externalType to checkTypeRequirements for function
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -305,8 +305,12 @@ TypePointer FunctionDefinition::getType(ContractDefinition const*) const void FunctionDefinition::checkTypeRequirements() { for (ASTPointer<VariableDeclaration> const& var: getParameters() + getReturnParameters()) + { if (!var->getType()->canLiveOutsideStorage()) 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) modifier->checkTypeRequirements(isConstructor() ? dynamic_cast<ContractDefinition const&>(*getScope()).getBaseContracts() : @@ -653,6 +657,10 @@ void MemberAccess::checkTypeRequirements() if (!m_type) BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found or not " "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. if (type.getCategory() == Type::Category::Struct) m_isLValue = true; |