Restrict parse/analyse in CompilerStack

This commit is contained in:
Alex Beregszaszi 2019-02-28 13:38:54 +00:00
parent 6aab3b1369
commit 679ff78714

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;