aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/AST.cpp b/AST.cpp
index 0fafd2d1..c6d8f5c5 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -274,6 +274,15 @@ TypePointer FunctionDefinition::getType(ContractDefinition const*) const
void FunctionDefinition::checkTypeRequirements()
{
+ // change all byte arrays parameters to point to calldata
+ if (getVisibility() == Visibility::External)
+ for (ASTPointer<VariableDeclaration> const& var: getParameters())
+ {
+ auto const& type = var->getType();
+ solAssert(!!type, "");
+ if (auto const* byteArrayType = dynamic_cast<ByteArrayType const*>(type.get()))
+ var->setType(byteArrayType->copyForLocation(ByteArrayType::Location::CallData));
+ }
for (ASTPointer<VariableDeclaration> const& var: getParameters() + getReturnParameters())
if (!var->getType()->canLiveOutsideStorage())
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));