aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-03-29 21:29:30 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-21 02:38:00 +0800
commit115458c50eec4dc32fdbfe5847fca4134a470668 (patch)
tree29dc8a1741998254b2bcb585268cb57d778ef551
parent4eaee772b3b4afab9d47ab50327fe451ebff22f4 (diff)
downloaddexon-solidity-115458c50eec4dc32fdbfe5847fca4134a470668.tar.gz
dexon-solidity-115458c50eec4dc32fdbfe5847fca4134a470668.tar.zst
dexon-solidity-115458c50eec4dc32fdbfe5847fca4134a470668.zip
Output legacyAssembly in StandardCompiler
-rw-r--r--libsolidity/interface/StandardCompiler.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index c6a83bab..390332e8 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -44,6 +44,16 @@ Json::Value formatFatalError(string const& _type, string const& _description)
return output;
}
+StringMap createSourceList(Json::Value const& _input)
+{
+ StringMap sources;
+ Json::Value const& jsonSources = _input["sources"];
+ if (jsonSources.isObject())
+ for (auto const& sourceName: jsonSources.getMemberNames())
+ sources[sourceName] = jsonSources[sourceName]["content"].asString();
+ return sources;
+}
+
Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
{
m_compilerStack.reset(false);
@@ -139,7 +149,8 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
Json::Value evmData(Json::objectValue);
// @TODO: add ir
// @TODO: add assembly
- // @TODO: add legacyAssemblyJSON
+ ostringstream unused;
+ evmData["legacyAssembly"] = m_compilerStack.streamAssembly(unused, contractName, createSourceList(_input), true);
evmData["opcodes"] = solidity::disassemble(m_compilerStack.object(contractName).bytecode);
// @TODO: add methodIdentifiers
// @TODO: add gasEstimates