Merge pull request #70 from chriseth/sol_libraries2

Commandline interface for linker.
This commit is contained in:
chriseth
2015-09-14 14:56:01 +02:00
5 changed files with 148 additions and 6 deletions
+10
View File
@@ -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);
+5 -2
View File
@@ -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
+5 -2
View File
@@ -925,7 +925,10 @@ bool ContractType::operator==(Type const& _other) const
string ContractType::toString(bool) const
{
return "contract " + string(m_super ? "super " : "") + m_contract.name();
return
string(m_contract.isLibrary() ? "library " : "contract ") +
string(m_super ? "super " : "") +
m_contract.name();
}
MemberList const& ContractType::members() const
@@ -971,7 +974,7 @@ MemberList const& ContractType::members() const
for (auto const& it: m_contract.interfaceFunctions())
members.push_back(MemberList::Member(
it.second->declaration().name(),
it.second->asMemberFunction(false),
it.second->asMemberFunction(m_contract.isLibrary()),
&it.second->declaration()
));
m_members.reset(new MemberList(members));