libsolidity: Introducing TypeProvider API, for clear type system ownership.

This commit is contained in:
Christian Parpart
2019-04-16 18:26:45 +02:00
committed by chriseth
parent 862d798047
commit bf43eebea9
38 changed files with 1489 additions and 837 deletions
+22
View File
@@ -38,6 +38,7 @@
#include <libsolidity/analysis/ViewPureChecker.h>
#include <libsolidity/ast/AST.h>
#include <libsolidity/ast/TypeProvider.h>
#include <libsolidity/codegen/Compiler.h>
#include <libsolidity/formal/SMTChecker.h>
#include <libsolidity/interface/ABI.h>
@@ -66,6 +67,26 @@ using namespace dev;
using namespace langutil;
using namespace dev::solidity;
static int g_compilerStackCounts = 0;
CompilerStack::CompilerStack(ReadCallback::Callback const& _readFile):
m_readFile{_readFile},
m_generateIR{false},
m_errorList{},
m_errorReporter{m_errorList}
{
// Because TypeProvider is currently a singleton API, we must ensure that
// no more than one entity is actually using it at a time.
solAssert(g_compilerStackCounts == 0, "You shall not have another CompilerStack aside me.");
++g_compilerStackCounts;
}
CompilerStack::~CompilerStack()
{
--g_compilerStackCounts;
TypeProvider::reset();
}
boost::optional<CompilerStack::Remapping> CompilerStack::parseRemapping(string const& _remapping)
{
auto eq = find(_remapping.begin(), _remapping.end(), '=');
@@ -157,6 +178,7 @@ void CompilerStack::reset(bool _keepSettings)
m_sourceOrder.clear();
m_contracts.clear();
m_errorReporter.clear();
TypeProvider::reset();
}
void CompilerStack::setSources(StringMap const& _sources)