diff options
author | Christian <c@ethdev.com> | 2015-02-17 00:33:13 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-17 02:35:53 +0800 |
commit | a33fa270f689168f84c0db6aa673658ae92fb495 (patch) | |
tree | 7a7916674b8dd8deef8276887f98e8a1d4dc6a03 /AST.cpp | |
parent | 971cc9b5b9242f36c1fa288615e2bf2d762fbd52 (diff) | |
download | dexon-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.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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.")); |