From e1df3bd77f78d5564fc173474015e5d84b192824 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 9 Nov 2016 13:34:51 +0100 Subject: Fix tests. --- libsolidity/codegen/LValue.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libsolidity/codegen') diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 66449fc4..2ec7f800 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -177,6 +177,7 @@ void StorageItem::retrieveValue(SourceLocation const&, bool _remove) const m_context << Instruction::POP << Instruction::SLOAD; else { + bool cleaned = false; m_context << Instruction::SWAP1 << Instruction::SLOAD << Instruction::SWAP1 << u256(0x100) << Instruction::EXP << Instruction::SWAP1 << Instruction::DIV; @@ -184,18 +185,27 @@ void StorageItem::retrieveValue(SourceLocation const&, bool _remove) const // implementation should be very similar to the integer case. solUnimplemented("Not yet implemented - FixedPointType."); if (m_dataType->category() == Type::Category::FixedBytes) + { m_context << (u256(0x1) << (256 - 8 * m_dataType->storageBytes())) << Instruction::MUL; + cleaned = true; + } else if ( m_dataType->category() == Type::Category::Integer && dynamic_cast(*m_dataType).isSigned() ) + { m_context << u256(m_dataType->storageBytes() - 1) << Instruction::SIGNEXTEND; + cleaned = true; + } else if (FunctionType const* fun = dynamic_cast(m_dataType)) { if (fun->location() == FunctionType::Location::External) + { CompilerUtils(m_context).splitExternalFunctionType(false); + cleaned = true; + } } - else + if (!cleaned) { solAssert(m_dataType->sizeOnStack() == 1, ""); m_context << ((u256(0x1) << (8 * m_dataType->storageBytes())) - 1) << Instruction::AND; -- cgit