From a25d8cd5538e1cd4dd58e591f800ca2e5eed0e64 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 16 Mar 2015 18:06:34 +0100 Subject: [PATCH] Move memberlist to avoid unique_ptr copy. --- libsolidity/Types.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 147eff1ec..72f13a01c 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -1246,23 +1246,29 @@ MagicType::MagicType(MagicType::Kind _kind): switch (m_kind) { case Kind::Block: - m_members = MemberList({{"coinbase", make_shared(0, IntegerType::Modifier::Address)}, - {"timestamp", make_shared(256)}, - {"blockhash", make_shared(strings{"uint"}, strings{"bytes32"}, FunctionType::Location::BlockHash)}, - {"difficulty", make_shared(256)}, - {"number", make_shared(256)}, - {"gaslimit", make_shared(256)}}); + m_members = move(MemberList({ + {"coinbase", make_shared(0, IntegerType::Modifier::Address)}, + {"timestamp", make_shared(256)}, + {"blockhash", make_shared(strings{"uint"}, strings{"bytes32"}, FunctionType::Location::BlockHash)}, + {"difficulty", make_shared(256)}, + {"number", make_shared(256)}, + {"gaslimit", make_shared(256)} + })); break; case Kind::Message: - m_members = MemberList({{"sender", make_shared(0, IntegerType::Modifier::Address)}, - {"gas", make_shared(256)}, - {"value", make_shared(256)}, - {"data", make_shared(ArrayType::Location::CallData)}, - {"sig", make_shared(4)}}); + m_members = move(MemberList({ + {"sender", make_shared(0, IntegerType::Modifier::Address)}, + {"gas", make_shared(256)}, + {"value", make_shared(256)}, + {"data", make_shared(ArrayType::Location::CallData)}, + {"sig", make_shared(4)} + })); break; case Kind::Transaction: - m_members = MemberList({{"origin", make_shared(0, IntegerType::Modifier::Address)}, - {"gasprice", make_shared(256)}}); + m_members = move(MemberList({ + {"origin", make_shared(0, IntegerType::Modifier::Address)}, + {"gasprice", make_shared(256)} + })); break; default: BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown kind of magic."));