aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-17 00:33:13 +0800
committerChristian <c@ethdev.com>2015-02-17 02:35:53 +0800
commita33fa270f689168f84c0db6aa673658ae92fb495 (patch)
tree7a7916674b8dd8deef8276887f98e8a1d4dc6a03 /AST.cpp
parent971cc9b5b9242f36c1fa288615e2bf2d762fbd52 (diff)
downloaddexon-solidity-a33fa270f689168f84c0db6aa673658ae92fb495.tar.gz
dexon-solidity-a33fa270f689168f84c0db6aa673658ae92fb495.tar.zst
dexon-solidity-a33fa270f689168f84c0db6aa673658ae92fb495.zip
Calldata byte arrays stored on the stack.
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."));