mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Split ABI out of InterfaceHandler
This commit is contained in:
1 parent
4bf3cbb09a
commit
12328b7848
6 files changed
+212
-105
No files matched your search
@@ -37,6 +37,7 @@
|
||||
#include <libsolidity/analysis/PostTypeChecker.h>
|
||||
#include <libsolidity/analysis/SyntaxChecker.h>
|
||||
#include <libsolidity/codegen/Compiler.h>
|
||||
#include <libsolidity/interface/ABI.h>
|
||||
#include <libsolidity/interface/InterfaceHandler.h>
|
||||
#include <libsolidity/interface/GasEstimator.h>
|
||||
#include <libsolidity/formal/Why3Translator.h>
|
||||
@@ -446,12 +447,21 @@ map<string, unsigned> CompilerStack::sourceIndices() const
|
||||
|
||||
Json::Value const& CompilerStack::contractABI(string const& _contractName) const
|
||||
{
|
||||
return metadata(_contractName, DocumentationType::ABIInterface);
|
||||
return contractABI(contract(_contractName));
|
||||
}
|
||||
|
||||
Json::Value const& CompilerStack::contractABI(Contract const& _contract) const
|
||||
{
|
||||
return metadata(_contract, DocumentationType::ABIInterface);
|
||||
if (m_stackState < AnalysisSuccessful)
|
||||
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
|
||||
|
||||
solAssert(_contract.contract, "");
|
||||
|
||||
// caches the result
|
||||
if (!_contract.abi)
|
||||
_contract.abi.reset(new Json::Value(ABI::generate(*_contract.contract)));
|
||||
|
||||
return *_contract.abi;
|
||||
}
|
||||
|
||||
Json::Value const& CompilerStack::metadata(string const& _contractName, DocumentationType _type) const
|
||||
@@ -476,9 +486,6 @@ Json::Value const& CompilerStack::metadata(Contract const& _contract, Documentat
|
||||
case DocumentationType::NatspecDev:
|
||||
doc = &_contract.devDocumentation;
|
||||
break;
|
||||
case DocumentationType::ABIInterface:
|
||||
doc = &_contract.interface;
|
||||
break;
|
||||
default:
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Illegal documentation type."));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user