aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-21 07:40:38 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-03-21 22:53:29 +0800
commitcc2f71e4acede70f6c220d3d0ba407ab73c2024c (patch)
treeb280c6bbd441b395a3ed172bdb01d60f40ff15a7 /libsolidity/codegen/ExpressionCompiler.cpp
parent32c94f505901201126000eb12087251f5695acbd (diff)
downloaddexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.gz
dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.tar.zst
dexon-solidity-cc2f71e4acede70f6c220d3d0ba407ab73c2024c.zip
Move dynamic type removal out of the type system.
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index f50628ff..7d148c0c 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -139,8 +139,8 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const&
utils().popStackSlots(paramTypes.size() - 1);
}
unsigned retSizeOnStack = 0;
- solAssert(accessorType.returnParameterTypes().size() >= 1, "");
- auto const& returnTypes = accessorType.returnParameterTypes();
+ auto returnTypes = accessorType.returnParameterTypes();
+ solAssert(returnTypes.size() >= 1, "");
if (StructType const* structType = dynamic_cast<StructType const*>(returnType.get()))
{
// remove offset
@@ -1618,15 +1618,22 @@ void ExpressionCompiler::appendExternalFunctionCall(
m_context.experimentalFeatureActive(ExperimentalFeature::V050) &&
m_context.evmVersion().hasStaticCall();
+ bool allowDynamicTypes = false; // @TODO
unsigned retSize = 0;
+ TypePointers returnTypes;
if (returnSuccessCondition)
retSize = 0; // return value actually is success condition
+ else if (allowDynamicTypes)
+ returnTypes = _functionType.returnParameterTypes();
else
- for (auto const& retType: _functionType.returnParameterTypes())
+ {
+ returnTypes = _functionType.returnParameterTypesWithoutDynamicTypes();
+ for (auto const& retType: returnTypes)
{
solAssert(!retType->isDynamicallySized(), "Unable to return dynamic type from external call.");
retSize += retType->calldataEncodedSize();
}
+ }
// Evaluate arguments.
TypePointers argumentTypes;
@@ -1824,11 +1831,11 @@ void ExpressionCompiler::appendExternalFunctionCall(
utils().fetchFreeMemoryPointer();
m_context << Instruction::SUB << Instruction::MLOAD;
}
- else if (!_functionType.returnParameterTypes().empty())
+ else if (!returnTypes.empty())
{
utils().fetchFreeMemoryPointer();
bool memoryNeeded = false;
- for (auto const& retType: _functionType.returnParameterTypes())
+ for (auto const& retType: returnTypes)
{
utils().loadFromMemoryDynamic(*retType, false, true, true);
if (dynamic_cast<ReferenceType const*>(retType.get()))