Browse Source

Move memberlist to avoid unique_ptr copy.

cl-refactor
chriseth 10 years ago
parent
commit
a25d8cd553
  1. 32
      libsolidity/Types.cpp

32
libsolidity/Types.cpp

@ -1246,23 +1246,29 @@ MagicType::MagicType(MagicType::Kind _kind):
switch (m_kind) switch (m_kind)
{ {
case Kind::Block: case Kind::Block:
m_members = MemberList({{"coinbase", make_shared<IntegerType>(0, IntegerType::Modifier::Address)}, m_members = move(MemberList({
{"timestamp", make_shared<IntegerType>(256)}, {"coinbase", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},
{"blockhash", make_shared<FunctionType>(strings{"uint"}, strings{"bytes32"}, FunctionType::Location::BlockHash)}, {"timestamp", make_shared<IntegerType>(256)},
{"difficulty", make_shared<IntegerType>(256)}, {"blockhash", make_shared<FunctionType>(strings{"uint"}, strings{"bytes32"}, FunctionType::Location::BlockHash)},
{"number", make_shared<IntegerType>(256)}, {"difficulty", make_shared<IntegerType>(256)},
{"gaslimit", make_shared<IntegerType>(256)}}); {"number", make_shared<IntegerType>(256)},
{"gaslimit", make_shared<IntegerType>(256)}
}));
break; break;
case Kind::Message: case Kind::Message:
m_members = MemberList({{"sender", make_shared<IntegerType>(0, IntegerType::Modifier::Address)}, m_members = move(MemberList({
{"gas", make_shared<IntegerType>(256)}, {"sender", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},
{"value", make_shared<IntegerType>(256)}, {"gas", make_shared<IntegerType>(256)},
{"data", make_shared<ArrayType>(ArrayType::Location::CallData)}, {"value", make_shared<IntegerType>(256)},
{"sig", make_shared<FixedBytesType>(4)}}); {"data", make_shared<ArrayType>(ArrayType::Location::CallData)},
{"sig", make_shared<FixedBytesType>(4)}
}));
break; break;
case Kind::Transaction: case Kind::Transaction:
m_members = MemberList({{"origin", make_shared<IntegerType>(0, IntegerType::Modifier::Address)}, m_members = move(MemberList({
{"gasprice", make_shared<IntegerType>(256)}}); {"origin", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},
{"gasprice", make_shared<IntegerType>(256)}
}));
break; break;
default: default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown kind of magic.")); BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown kind of magic."));

Loading…
Cancel
Save