Merge pull request #6140 from ethereum/compilerstack-restrict

Restrict parse/analyse in CompilerStack
This commit is contained in:
chriseth 2019-02-28 16:26:47 +01:00 committed by GitHub
commit 8649f0ab59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,9 +167,8 @@ bool CompilerStack::addSource(string const& _name, string const& _content, bool
bool CompilerStack::parse()
{
//reset
if (m_stackState != SourcesSet)
return false;
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Must call parse only after the SourcesSet state."));
m_errorReporter.clear();
ASTNode::resetID();
@ -210,8 +209,8 @@ bool CompilerStack::parse()
bool CompilerStack::analyze()
{
if (m_stackState != ParsingSuccessful)
return false;
if (m_stackState != ParsingSuccessful || m_stackState >= AnalysisSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Must call analyze only after parsing was successful."));
resolveImports();
bool noErrors = true;