From 9cc7402c9583ca3bfc9fcb234443d2f90b890190 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 2 Oct 2015 13:11:38 +0200 Subject: Split external type into ecoding and interface type. --- libsolidity/CompilerUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libsolidity/CompilerUtils.cpp') diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index d6624ca4..31000f0b 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -160,7 +160,7 @@ void CompilerUtils::encodeToMemory( TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; solAssert(targetTypes.size() == _givenTypes.size(), ""); for (TypePointer& t: targetTypes) - t = t->mobileType()->externalType(); + t = t->mobileType()->encodingType(); // Stack during operation: // ... ... -- cgit v1.2.3 From 421dcf4c1a38a5e691aec5d791155adbcf732c90 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 2 Oct 2015 22:34:47 +0200 Subject: Tests apart from new one work fine. --- libsolidity/CompilerUtils.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libsolidity/CompilerUtils.cpp') diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 31000f0b..583d267a 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -153,14 +153,15 @@ void CompilerUtils::encodeToMemory( TypePointers const& _givenTypes, TypePointers const& _targetTypes, bool _padToWordBoundaries, - bool _copyDynamicDataInPlace + bool _copyDynamicDataInPlace, + bool _encodeAsLibraryTypes ) { // stack: ... TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; solAssert(targetTypes.size() == _givenTypes.size(), ""); for (TypePointer& t: targetTypes) - t = t->mobileType()->encodingType(); + t = t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType(); // Stack during operation: // ... ... -- cgit v1.2.3 From ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 4 Oct 2015 11:05:57 +0200 Subject: Encode storage items correctly for library calls. --- libsolidity/CompilerUtils.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libsolidity/CompilerUtils.cpp') diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 583d267a..e1152202 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -189,7 +189,14 @@ void CompilerUtils::encodeToMemory( copyToStackTop(argSize - stackPos + dynPointers + 2, _givenTypes[i]->sizeOnStack()); solAssert(!!targetType, "Externalable type expected."); TypePointer type = targetType; - if ( + if (_givenTypes[i]->dataStoredIn(DataLocation::Storage) && targetType->isValueType()) + { + // special case: convert storage reference type to value type - this is only + // possible for library calls where we just forward the storage reference + solAssert(_encodeAsLibraryTypes, ""); + solAssert(_givenTypes[i]->sizeOnStack() == 1, ""); + } + else if ( _givenTypes[i]->dataStoredIn(DataLocation::Storage) || _givenTypes[i]->dataStoredIn(DataLocation::CallData) || _givenTypes[i]->category() == Type::Category::StringLiteral -- cgit v1.2.3