fixed-sized arrays as return type

Conflicts:
	test/libsolidity/SolidityEndToEndTest.cpp
This commit is contained in:
LianaHus
2015-09-23 17:31:37 +02:00
parent 09f1f1e595
commit 9547c4563c
5 changed files with 54 additions and 10 deletions
+18 -7
View File
@@ -86,16 +86,27 @@ void CompilerUtils::loadFromMemoryDynamic(
bool _padToWordBoundaries,
bool _keepUpdatedMemoryOffset
)
{
solAssert(_type.category() != Type::Category::Array, "Arrays not yet implemented.");
{
if (_keepUpdatedMemoryOffset)
m_context << eth::Instruction::DUP1;
unsigned numBytes = loadFromMemoryHelper(_type, _fromCalldata, _padToWordBoundaries);
if (_keepUpdatedMemoryOffset)
if (auto arrayType = dynamic_cast<ArrayType const*>(&_type))
{
// update memory counter
moveToStackTop(_type.sizeOnStack());
m_context << u256(numBytes) << eth::Instruction::ADD;
solAssert(!arrayType->isDynamicallySized(), "");
solAssert(!_fromCalldata, "");
solAssert(_padToWordBoundaries, "");
if (_keepUpdatedMemoryOffset)
m_context << arrayType->memorySize() << eth::Instruction::ADD;
}
else
{
unsigned numBytes = loadFromMemoryHelper(_type, _fromCalldata, _padToWordBoundaries);
if (_keepUpdatedMemoryOffset)
{
// update memory counter
moveToStackTop(_type.sizeOnStack());
m_context << u256(numBytes) << eth::Instruction::ADD;
}
}
}