diff options
author | chriseth <chris@ethereum.org> | 2017-09-12 19:23:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-12 19:23:59 +0800 |
commit | 513ae59bba018d865fef620c79f131b70554c042 (patch) | |
tree | fc40ae93202787313e1c43822500c9126a1eedf4 /solc | |
parent | 4cb5502faa2004d738c25e4dcdf4f6678540017e (diff) | |
parent | bd6510d99a503ddbdbfaa9bd459f020215f8a028 (diff) | |
download | dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar.gz dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar.bz2 dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar.lz dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar.xz dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.tar.zst dexon-solidity-513ae59bba018d865fef620c79f131b70554c042.zip |
Merge pull request #2853 from ethereum/cleanup-asm-stream
Split out the JSON functionality from assembly.stream()
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 315f951e..e6d8776b 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); @@ -1150,16 +1147,19 @@ void CommandLineInterface::outputCompilationResults() // do we need EVM assembly? if (m_args.count(g_argAsm) || m_args.count(g_argAsmJson)) { + string ret; + if (m_args.count(g_argAsmJson)) + ret = dev::jsonPrettyPrint(m_compiler->assemblyJSON(contract, m_sourceCodes)); + else + ret = m_compiler->assemblyString(contract, m_sourceCodes); + 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()); + createFile(m_compiler->filesystemFriendlyName(contract) + (m_args.count(g_argAsmJson) ? "_evm.json" : ".evm"), ret); } else { - cout << "EVM assembly:" << endl; - m_compiler->streamAssembly(cout, contract, m_sourceCodes, m_args.count(g_argAsmJson)); + cout << "EVM assembly:" << endl << ret << endl; } } |