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));
|
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 AnalysisFramework::filterErrors(ErrorList const& _errorList, bool _includeWarningsAndInfos) const
|
||||||
{
|
{
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
|
@ -76,7 +76,7 @@ protected:
|
|||||||
solidity::frontend::CompilerStack& compiler()
|
solidity::frontend::CompilerStack& compiler()
|
||||||
{
|
{
|
||||||
if (!m_compiler)
|
if (!m_compiler)
|
||||||
m_compiler = std::make_unique<solidity::frontend::CompilerStack>();
|
m_compiler = createStack();
|
||||||
return *m_compiler;
|
return *m_compiler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +84,14 @@ protected:
|
|||||||
solidity::frontend::CompilerStack const& compiler() const
|
solidity::frontend::CompilerStack const& compiler() const
|
||||||
{
|
{
|
||||||
if (!m_compiler)
|
if (!m_compiler)
|
||||||
m_compiler = std::make_unique<solidity::frontend::CompilerStack>();
|
m_compiler = createStack();
|
||||||
return *m_compiler;
|
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:
|
private:
|
||||||
mutable std::unique_ptr<solidity::frontend::CompilerStack> m_compiler;
|
mutable std::unique_ptr<solidity::frontend::CompilerStack> m_compiler;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user