aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-04 17:05:57 +0800
committerchriseth <c@ethdev.com>2015-10-06 20:20:06 +0800
commitce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc (patch)
treeea0f50129f8e1837f3fcef38f8101b23e6e703c6 /libsolidity
parent421dcf4c1a38a5e691aec5d791155adbcf732c90 (diff)
downloaddexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.gz
dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.tar.zst
dexon-solidity-ce25ddfa6a9b8cfff08b4a05591dcc3b4a8b63cc.zip
Encode storage items correctly for library calls.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/CompilerUtils.cpp9
-rw-r--r--libsolidity/ExpressionCompiler.cpp3
2 files changed, 10 insertions, 2 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
diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp
index 49bf2559..a4b63696 100644
--- a/libsolidity/ExpressionCompiler.cpp
+++ b/libsolidity/ExpressionCompiler.cpp
@@ -1179,7 +1179,8 @@ void ExpressionCompiler::appendExternalFunctionCall(
argumentTypes,
_functionType.parameterTypes(),
_functionType.padArguments(),
- _functionType.takesArbitraryParameters()
+ _functionType.takesArbitraryParameters(),
+ isCallCode
);
// Stack now: