aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/LValue.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-09 20:34:51 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:18 +0800
commite1df3bd77f78d5564fc173474015e5d84b192824 (patch)
tree7651d6e931d2ff3ebe7d518c77dc59189f0ff2ae /libsolidity/codegen/LValue.cpp
parentf21f794f3c380c9382ace4908c38d0f6c776ae17 (diff)
downloaddexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.gz
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.bz2
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.lz
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.xz
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.tar.zst
dexon-solidity-e1df3bd77f78d5564fc173474015e5d84b192824.zip
Fix tests.
Diffstat (limited to 'libsolidity/codegen/LValue.cpp')
-rw-r--r--libsolidity/codegen/LValue.cpp12
1 files changed, 11 insertions, 1 deletions
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<IntegerType const&>(*m_dataType).isSigned()
)
+ {
m_context << u256(m_dataType->storageBytes() - 1) << Instruction::SIGNEXTEND;
+ cleaned = true;
+ }
else if (FunctionType const* fun = dynamic_cast<decltype(fun)>(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;