aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-02-20 00:43:53 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-02-20 00:43:53 +0800
commit26132363d5a11d762224cc7c8acc6b8c854cf646 (patch)
tree603b725cc99d0c7f636f876ff414c3672fea8696 /NameAndTypeResolver.cpp
parenta2f5ea88b8e3a010c5543ef341bc111d3e958de0 (diff)
downloaddexon-solidity-26132363d5a11d762224cc7c8acc6b8c854cf646.tar.gz
dexon-solidity-26132363d5a11d762224cc7c8acc6b8c854cf646.tar.zst
dexon-solidity-26132363d5a11d762224cc7c8acc6b8c854cf646.zip
Bugfix for functions override
- Functions with byte array type parameters can now be safely overriden. Parameter location is now set at the right place. - Also made a test for the fix
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index ea70b65b..e19b0bf9 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -333,7 +333,13 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable)
// or mapping
if (_variable.getTypeName())
{
- _variable.setType(_variable.getTypeName()->toType());
+ TypePointer type = _variable.getTypeName()->toType();
+ // All byte array parameter types should point to call data
+ if (_variable.isExternalFunctionParameter())
+ if (auto const* byteArrayType = dynamic_cast<ByteArrayType const*>(type.get()))
+ type = byteArrayType->copyForLocation(ByteArrayType::Location::CallData);
+ _variable.setType(type);
+
if (!_variable.getType())
BOOST_THROW_EXCEPTION(_variable.getTypeName()->createTypeError("Invalid type name"));
}