diff options
author | chriseth <chris@ethereum.org> | 2018-12-18 20:09:31 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-18 23:10:14 +0800 |
commit | 18efbb52c0e22a6bac4427053dbda66d38319cbf (patch) | |
tree | fce7d537266c1582460fa82628f490019f311460 /libevmasm/AssemblyItem.h | |
parent | a51a8368aaa44bd1b26eb6869b107f6f3b3eec05 (diff) | |
download | dexon-solidity-18efbb52c0e22a6bac4427053dbda66d38319cbf.tar.gz dexon-solidity-18efbb52c0e22a6bac4427053dbda66d38319cbf.tar.zst dexon-solidity-18efbb52c0e22a6bac4427053dbda66d38319cbf.zip |
Use the move.
Diffstat (limited to 'libevmasm/AssemblyItem.h')
-rw-r--r-- | libevmasm/AssemblyItem.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index a7875171..e17179fa 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -57,22 +57,26 @@ class AssemblyItem public: enum class JumpType { Ordinary, IntoFunction, OutOfFunction }; - AssemblyItem(u256 _push, langutil::SourceLocation const& _location = langutil::SourceLocation()): - AssemblyItem(Push, _push, _location) { } - AssemblyItem(solidity::Instruction _i, langutil::SourceLocation const& _location = langutil::SourceLocation()): + AssemblyItem(u256 _push, langutil::SourceLocation _location = langutil::SourceLocation()): + AssemblyItem(Push, std::move(_push), std::move(_location)) { } + AssemblyItem(solidity::Instruction _i, langutil::SourceLocation _location = langutil::SourceLocation()): m_type(Operation), m_instruction(_i), - m_location(_location) + m_location(std::move(_location)) {} - AssemblyItem(AssemblyItemType _type, u256 _data = 0, langutil::SourceLocation const& _location = langutil::SourceLocation()): + AssemblyItem(AssemblyItemType _type, u256 _data = 0, langutil::SourceLocation _location = langutil::SourceLocation()): m_type(_type), - m_location(_location) + m_location(std::move(_location)) { if (m_type == Operation) m_instruction = Instruction(uint8_t(_data)); else - m_data = std::make_shared<u256>(_data); + m_data = std::make_shared<u256>(std::move(_data)); } + AssemblyItem(AssemblyItem const&) = default; + AssemblyItem(AssemblyItem&&) = default; + AssemblyItem& operator=(AssemblyItem const&) = default; + AssemblyItem& operator=(AssemblyItem&&) = default; AssemblyItem tag() const { assertThrow(m_type == PushTag || m_type == Tag, Exception, ""); return AssemblyItem(Tag, data()); } AssemblyItem pushTag() const { assertThrow(m_type == PushTag || m_type == Tag, Exception, ""); return AssemblyItem(PushTag, data()); } |