diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-15 17:22:47 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-11 22:48:52 +0800 |
commit | a535a8b06ed1b9c0c5fd41805a4fe39939755f05 (patch) | |
tree | 94484019deeef72cc1bab99de51b844647ec6881 /solc/CommandLineInterface.cpp | |
parent | 55d2a459a9193024930101c79bbf48af2eb39e2d (diff) | |
download | dexon-solidity-a535a8b06ed1b9c0c5fd41805a4fe39939755f05.tar.gz dexon-solidity-a535a8b06ed1b9c0c5fd41805a4fe39939755f05.tar.zst dexon-solidity-a535a8b06ed1b9c0c5fd41805a4fe39939755f05.zip |
Split out the JSON functionality from assembly.stream()
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r-- | solc/CommandLineInterface.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 315f951e..560dc98b 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -865,10 +865,7 @@ void CommandLineInterface::handleCombinedJSON() if (requests.count(g_strOpcodes)) contractData[g_strOpcodes] = solidity::disassemble(m_compiler->object(contractName).bytecode); if (requests.count(g_strAsm)) - { - ostringstream unused; - contractData[g_strAsm] = m_compiler->streamAssembly(unused, contractName, m_sourceCodes, true); - } + contractData[g_strAsm] = m_compiler->assemblyJSON(contractName, m_sourceCodes); if (requests.count(g_strSrcMap)) { auto map = m_compiler->sourceMapping(contractName); @@ -1152,14 +1149,25 @@ void CommandLineInterface::outputCompilationResults() { if (m_args.count(g_argOutputDir)) { - stringstream data; - m_compiler->streamAssembly(data, contract, m_sourceCodes, m_args.count(g_argAsmJson)); - createFile(m_compiler->filesystemFriendlyName(contract) + (m_args.count(g_argAsmJson) ? "_evm.json" : ".evm"), data.str()); + if (m_args.count(g_argAsmJson) + { + Json::Value ret = m_compiler->assemblyJSON(contract, m_sourceCodes); + createFile(m_compiler->filesystemFriendlyName(contract) + "_evm.json", dev::jsonPrettyPrint(ret)); + } + else + { + stringstream data; + m_compiler->assemblyStream(data, contract, m_sourceCodes); + createFile(m_compiler->filesystemFriendlyName(contract) + ".evm", data.str()); + } } else { cout << "EVM assembly:" << endl; - m_compiler->streamAssembly(cout, contract, m_sourceCodes, m_args.count(g_argAsmJson)); + if (m_args.count(g_argAsmJson) + cout << m_compiler->assemblyJSON(contract, m_sourceCodes); + else + m_compiler->assemblyStream(cout, contract, m_sourceCodes); } } |