aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-05-07 01:02:56 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-19 22:57:36 +0800
commit4bf3cbb09a42131dba27b080a4917f30284959d3 (patch)
tree04623e38aee222c71192d42b132dc56a35fe621f /solc/CommandLineInterface.cpp
parent8169e149c98b14861cc6467f9f796010f617c521 (diff)
downloaddexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.tar.gz
dexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.tar.zst
dexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.zip
Use CompilerStack.contractABI directly
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index badebf38..ab79aaa3 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -266,12 +266,24 @@ void CommandLineInterface::handleOnChainMetadata(string const& _contract)
return;
string data = m_compiler->onChainMetadata(_contract);
- if (m_args.count("output-dir"))
+ if (m_args.count(g_argOutputDir))
createFile(m_compiler->filesystemFriendlyName(_contract) + "_meta.json", data);
else
cout << "Metadata: " << endl << data << endl;
}
+void CommandLineInterface::handleABI(string const& _contract)
+{
+ if (!m_args.count(g_argAbi))
+ return;
+
+ string data = dev::jsonCompactPrint(m_compiler->contractABI(_contract));
+ if (m_args.count(g_argOutputDir))
+ createFile(m_compiler->filesystemFriendlyName(_contract) + ".abi", data);
+ else
+ cout << "Contract JSON ABI " << endl << data << endl;
+}
+
void CommandLineInterface::handleMeta(DocumentationType _type, string const& _contract)
{
std::string argName;
@@ -279,11 +291,6 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
std::string title;
switch(_type)
{
- case DocumentationType::ABIInterface:
- argName = g_argAbi;
- suffix = ".abi";
- title = "Contract JSON ABI";
- break;
case DocumentationType::NatspecUser:
argName = g_argNatspecUser;
suffix = ".docuser";
@@ -301,11 +308,7 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
if (m_args.count(argName))
{
- std::string output;
- if (_type == DocumentationType::ABIInterface)
- output = dev::jsonCompactPrint(m_compiler->metadata(_contract, _type));
- else
- output = dev::jsonPrettyPrint(m_compiler->metadata(_contract, _type));
+ std::string output = dev::jsonPrettyPrint(m_compiler->metadata(_contract, _type));
if (m_args.count(g_argOutputDir))
createFile(m_compiler->filesystemFriendlyName(_contract) + suffix, output);
@@ -1069,7 +1072,7 @@ void CommandLineInterface::outputCompilationResults()
handleBytecode(contract);
handleSignatureHashes(contract);
handleOnChainMetadata(contract);
- handleMeta(DocumentationType::ABIInterface, contract);
+ handleABI(contract);
handleMeta(DocumentationType::NatspecDev, contract);
handleMeta(DocumentationType::NatspecUser, contract);
} // end of contracts iteration