diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-11 22:18:56 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-11 22:53:20 +0800 |
commit | bd6510d99a503ddbdbfaa9bd459f020215f8a028 (patch) | |
tree | 3ae88a56a3effc7ab047b544dc827be2392adfae /solc | |
parent | bbfb16cf5ce903150bc3a141ac50553d8bf6d346 (diff) | |
download | dexon-solidity-bd6510d99a503ddbdbfaa9bd459f020215f8a028.tar.gz dexon-solidity-bd6510d99a503ddbdbfaa9bd459f020215f8a028.tar.zst dexon-solidity-bd6510d99a503ddbdbfaa9bd459f020215f8a028.zip |
Simplify assembly printing in CLI
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 32c61585..e6d8776b 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1147,26 +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)) { - 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 - { - string ret = m_compiler->assemblyString(contract, m_sourceCodes); - createFile(m_compiler->filesystemFriendlyName(contract) + ".evm", ret)); - } + createFile(m_compiler->filesystemFriendlyName(contract) + (m_args.count(g_argAsmJson) ? "_evm.json" : ".evm"), ret); } else { - cout << "EVM assembly:" << endl; - if (m_args.count(g_argAsmJson) - cout << m_compiler->assemblyJSON(contract, m_sourceCodes); - else - cout << m_compiler->assemblyString(contract, m_sourceCodes); + cout << "EVM assembly:" << endl << ret << endl; } } |