mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7775 from ethereum/linkreferences
Clarify some notes in LinkerObject and assert that linkReferences are always correct
This commit is contained in:
commit
c4622774bb
@ -519,8 +519,11 @@ map<u256, u256> Assembly::optimiseInternal(
|
||||
|
||||
LinkerObject const& Assembly::assemble() const
|
||||
{
|
||||
// Return the already assembled object, if present.
|
||||
if (!m_assembledObject.bytecode.empty())
|
||||
return m_assembledObject;
|
||||
// Otherwise ensure the object is actually clear.
|
||||
assertThrow(m_assembledObject.linkReferences.empty(), AssemblyException, "Unexpected link references.");
|
||||
|
||||
size_t subTagSize = 1;
|
||||
for (auto const& sub: m_subs)
|
||||
|
@ -35,7 +35,9 @@ namespace eth
|
||||
*/
|
||||
struct LinkerObject
|
||||
{
|
||||
/// The bytecode.
|
||||
bytes bytecode;
|
||||
|
||||
/// Map from offsets in bytecode to library identifiers. The addresses starting at those offsets
|
||||
/// need to be replaced by the actual addresses by the linker.
|
||||
std::map<size_t, std::string> linkReferences;
|
||||
@ -47,7 +49,7 @@ struct LinkerObject
|
||||
void link(std::map<std::string, h160> const& _libraryAddresses);
|
||||
|
||||
/// @returns a hex representation of the bytecode of the given object, replacing unlinked
|
||||
/// addresses by placeholders.
|
||||
/// addresses by placeholders. This output is lowercase.
|
||||
std::string toHex() const;
|
||||
|
||||
/// @returns a 36 character string that is used as a placeholder for the library
|
||||
|
Loading…
Reference in New Issue
Block a user