diff options
author | chriseth <c@ethdev.com> | 2015-09-12 01:35:01 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-09-12 01:35:01 +0800 |
commit | 70c0ed41290f3de001fed5b4f0f28993486ba445 (patch) | |
tree | 3d7e817bda1c0e522caf046c6aece51d31e343fd /libsolidity | |
parent | 147830d1a3a2dc5748c11e41df6289655722cc4d (diff) | |
download | dexon-solidity-70c0ed41290f3de001fed5b4f0f28993486ba445.tar.gz dexon-solidity-70c0ed41290f3de001fed5b4f0f28993486ba445.tar.zst dexon-solidity-70c0ed41290f3de001fed5b4f0f28993486ba445.zip |
Commandline interface for the linker.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/CompilerStack.cpp | 10 | ||||
-rw-r--r-- | libsolidity/CompilerStack.h | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp index 3da982a4..70bb1b4c 100644 --- a/libsolidity/CompilerStack.cpp +++ b/libsolidity/CompilerStack.cpp @@ -181,6 +181,16 @@ eth::LinkerObject const& CompilerStack::compile(string const& _sourceCode, bool return object(); } +void CompilerStack::link(const std::map<string, h160>& _libraries) +{ + for (auto& contract: m_contracts) + { + contract.second.object.link(_libraries); + contract.second.runtimeObject.link(_libraries); + contract.second.cloneObject.link(_libraries); + } +} + eth::AssemblyItems const* CompilerStack::assemblyItems(string const& _contractName) const { Contract const& currentContract = contract(_contractName); diff --git a/libsolidity/CompilerStack.h b/libsolidity/CompilerStack.h index 8db8aff4..99e8af1a 100644 --- a/libsolidity/CompilerStack.h +++ b/libsolidity/CompilerStack.h @@ -96,9 +96,12 @@ public: /// @returns the compiled linker object eth::LinkerObject const& compile(std::string const& _sourceCode, bool _optimize = false); - /// @returns the assembled bytecode for a contract (empty if it has to be linked or lacks implementation). + /// Inserts the given addresses into the linker objects of all compiled contracts. + void link(std::map<std::string, h160> const& _libraries); + + /// @returns the assembled object for a contract. eth::LinkerObject const& object(std::string const& _contractName = "") const; - /// @returns the runtime bytecode for the contract (empty if it has to be linked or lacks implementation). + /// @returns the runtime object for the contract. eth::LinkerObject const& runtimeObject(std::string const& _contractName = "") const; /// @returns the bytecode of a contract that uses an already deployed contract via CALLCODE. /// The returned bytes will contain a sequence of 20 bytes of the format "XXX...XXX" which have to |