diff options
author | chriseth <c@ethdev.com> | 2015-10-04 17:05:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-06 20:20:06 +0800 |
commit | ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc (patch) | |
tree | ea0f50129f8e1837f3fcef38f8101b23e6e703c6 /libsolidity/CompilerUtils.cpp | |
parent | 421dcf4c1a38a5e691aec5d791155adbcf732c90 (diff) | |
download | dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.gz dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.bz2 dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.lz dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.xz dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.zst dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.zip |
Encode storage items correctly for library calls.
Diffstat (limited to 'libsolidity/CompilerUtils.cpp')
-rw-r--r-- | libsolidity/CompilerUtils.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
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 |