aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-03-20 00:33:10 +0800
committerLiana Husikyan <liana@ethdev.com>2015-03-25 20:59:39 +0800
commit60204d593e48d2f4395a34c3e7bb010d4f40e513 (patch)
tree0c5c17306fe5790032829b845bc5d3d661b6934b /AST.cpp
parent607f3972349a17b9d06aca0ce733789f16f573c1 (diff)
downloaddexon-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.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/AST.cpp b/AST.cpp
index d05eaf83..3ecf79eb 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -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;