mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
AnalysisFramework: Make it possible to customize CompilerStack creation
This commit is contained in:
parent
aecb11eff4
commit
f87bef2431
@ -75,6 +75,11 @@ AnalysisFramework::parseAnalyseAndReturnError(
|
||||
return make_pair(&compiler().ast(""), std::move(errors));
|
||||
}
|
||||
|
||||
std::unique_ptr<CompilerStack> AnalysisFramework::createStack() const
|
||||
{
|
||||
return std::make_unique<CompilerStack>();
|
||||
}
|
||||
|
||||
ErrorList AnalysisFramework::filterErrors(ErrorList const& _errorList, bool _includeWarningsAndInfos) const
|
||||
{
|
||||
ErrorList errors;
|
||||
|
@ -76,7 +76,7 @@ protected:
|
||||
solidity::frontend::CompilerStack& compiler()
|
||||
{
|
||||
if (!m_compiler)
|
||||
m_compiler = std::make_unique<solidity::frontend::CompilerStack>();
|
||||
m_compiler = createStack();
|
||||
return *m_compiler;
|
||||
}
|
||||
|
||||
@ -84,10 +84,14 @@ protected:
|
||||
solidity::frontend::CompilerStack const& compiler() const
|
||||
{
|
||||
if (!m_compiler)
|
||||
m_compiler = std::make_unique<solidity::frontend::CompilerStack>();
|
||||
m_compiler = createStack();
|
||||
return *m_compiler;
|
||||
}
|
||||
|
||||
/// Creates a new instance of @p CompilerStack. Override if your test case needs to pass in
|
||||
/// custom constructor arguments.
|
||||
virtual std::unique_ptr<CompilerStack> createStack() const;
|
||||
|
||||
private:
|
||||
mutable std::unique_ptr<solidity::frontend::CompilerStack> m_compiler;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user