aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-10-03 18:45:44 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-10-03 18:45:44 +0800
commit43719839bf02a17cea2014266abca837f88ab35e (patch)
tree91648fd012b01649f4d4b9fee228d23045a660ea
parent5c284589202c261c06dadfe7a598cc23752e8e48 (diff)
downloaddexon-solidity-43719839bf02a17cea2014266abca837f88ab35e.tar.gz
dexon-solidity-43719839bf02a17cea2014266abca837f88ab35e.tar.zst
dexon-solidity-43719839bf02a17cea2014266abca837f88ab35e.zip
Use isDup/SwapInstruction helper
-rw-r--r--libevmasm/AssemblyItem.cpp4
-rw-r--r--libevmasm/SemanticInformation.cpp4
2 files changed, 3 insertions, 5 deletions
diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp
index cfe91be0..64963021 100644
--- a/libevmasm/AssemblyItem.cpp
+++ b/libevmasm/AssemblyItem.cpp
@@ -17,8 +17,6 @@
#include <libevmasm/AssemblyItem.h>
-#include <libevmasm/SemanticInformation.h>
-
#include <libdevcore/CommonData.h>
#include <libdevcore/FixedHash.h>
@@ -112,7 +110,7 @@ bool AssemblyItem::canBeFunctional() const
switch (m_type)
{
case Operation:
- return !SemanticInformation::isDupInstruction(*this) && !SemanticInformation::isSwapInstruction(*this);
+ return !isDupInstruction(instruction()) && !isSwapInstruction(instruction());
case Push:
case PushString:
case PushTag:
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index ceb3fbdd..83cfe2c6 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -90,14 +90,14 @@ bool SemanticInformation::isDupInstruction(AssemblyItem const& _item)
{
if (_item.type() != Operation)
return false;
- return Instruction::DUP1 <= _item.instruction() && _item.instruction() <= Instruction::DUP16;
+ return solidity::isDupInstruction(_item.instruction());
}
bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
{
if (_item.type() != Operation)
return false;
- return Instruction::SWAP1 <= _item.instruction() && _item.instruction() <= Instruction::SWAP16;
+ return solidity::isSwapInstruction(_item.instruction());
}
bool SemanticInformation::isJumpInstruction(AssemblyItem const& _item)