mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add CompilerStack.setStdlib
This commit is contained in:
parent
e0727076d3
commit
2a07c6dfdc
@ -218,6 +218,13 @@ void CompilerStack::setViaIR(bool _viaIR)
|
||||
m_viaIR = _viaIR;
|
||||
}
|
||||
|
||||
void CompilerStack::setStdlib(bool _stdlib)
|
||||
{
|
||||
if (m_stackState >= ParsedAndImported)
|
||||
solThrow(CompilerError, "Must set stdlib before parsing.");
|
||||
m_stdlib = _stdlib;
|
||||
}
|
||||
|
||||
void CompilerStack::setEVMVersion(langutil::EVMVersion _version)
|
||||
{
|
||||
if (m_stackState >= ParsedAndImported)
|
||||
@ -340,6 +347,10 @@ bool CompilerStack::parse()
|
||||
|
||||
Parser parser{m_errorReporter, m_evmVersion, m_parserErrorRecovery};
|
||||
|
||||
if (m_stdlib) {
|
||||
// TODO: fill out m_sources
|
||||
}
|
||||
|
||||
vector<string> sourcesToParse;
|
||||
for (auto const& s: m_sources)
|
||||
sourcesToParse.push_back(s.first);
|
||||
@ -433,7 +444,7 @@ bool CompilerStack::analyze()
|
||||
if (source->ast && !syntaxChecker.checkSyntax(*source->ast))
|
||||
noErrors = false;
|
||||
|
||||
m_globalContext = make_shared<GlobalContext>(false);
|
||||
m_globalContext = make_shared<GlobalContext>(m_stdlib);
|
||||
// We need to keep the same resolver during the whole process.
|
||||
NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter);
|
||||
for (Source const* source: m_sourceOrder)
|
||||
|
||||
@ -169,6 +169,10 @@ public:
|
||||
/// Must be set before parsing.
|
||||
void setViaIR(bool _viaIR);
|
||||
|
||||
/// Sets the pipeline to use the stdlib or not.
|
||||
/// Must be set before parsing.
|
||||
void setStdlib(bool _stdlib);
|
||||
|
||||
/// Set the EVM version used before running compile.
|
||||
/// When called without an argument it will revert to the default version.
|
||||
/// Must be set before parsing.
|
||||
@ -487,6 +491,7 @@ private:
|
||||
RevertStrings m_revertStrings = RevertStrings::Default;
|
||||
State m_stopAfter = State::CompilationSuccessful;
|
||||
bool m_viaIR = false;
|
||||
bool m_stdlib = false;
|
||||
langutil::EVMVersion m_evmVersion;
|
||||
ModelCheckerSettings m_modelCheckerSettings;
|
||||
std::map<std::string, std::set<std::string>> m_requestedContractNames;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user