From 679ff787143d9cceb952bcfffbd8cf81f40bebd4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 28 Feb 2019 13:38:54 +0000 Subject: [PATCH] Restrict parse/analyse in CompilerStack --- libsolidity/interface/CompilerStack.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 4d0010428..ca958ff96 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -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;