From bd6510d99a503ddbdbfaa9bd459f020215f8a028 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 11 Sep 2017 15:18:56 +0100 Subject: Simplify assembly printing in CLI --- solc/CommandLineInterface.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'solc') 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; } } -- cgit