Merge pull request #144 from chriseth/doNotCatchInternalErrors

Do not catch InternalCompilerErrors as part of fatal error handling.
This commit is contained in:
chriseth 2015-10-16 15:20:09 +02:00
commit e5d473448b
4 changed files with 15 additions and 9 deletions

View File

@ -104,7 +104,9 @@ bool CompilerStack::parse()
for (auto& sourcePair: m_sources) for (auto& sourcePair: m_sources)
{ {
sourcePair.second.scanner->reset(); sourcePair.second.scanner->reset();
sourcePair.second.ast = Parser(m_errors).parse(sourcePair.second.scanner); // todo check for errors sourcePair.second.ast = Parser(m_errors).parse(sourcePair.second.scanner);
if (!sourcePair.second.ast)
solAssert(!Error::containsOnlyWarnings(m_errors), "Parser returned null but did not report error.");
} }
if (!Error::containsOnlyWarnings(m_errors)) if (!Error::containsOnlyWarnings(m_errors))
// errors while parsing. sould stop before type checking // errors while parsing. sould stop before type checking

View File

@ -49,8 +49,10 @@ bool NameAndTypeResolver::registerDeclarations(SourceUnit& _sourceUnit)
{ {
DeclarationRegistrationHelper registrar(m_scopes, _sourceUnit, m_errors); DeclarationRegistrationHelper registrar(m_scopes, _sourceUnit, m_errors);
} }
catch (FatalError) catch (FatalError const& _e)
{ {
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
return false; return false;
} }
return true; return true;
@ -124,6 +126,8 @@ bool NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
} }
catch (FatalError const& _e) catch (FatalError const& _e)
{ {
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
return false; return false;
} }
return true; return true;
@ -138,6 +142,8 @@ bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
} }
catch (FatalError const& _error) catch (FatalError const& _error)
{ {
if (m_errors.empty())
throw; // Something is weird here, rather throw again.
return false; return false;
} }
return true; return true;

View File

@ -90,10 +90,8 @@ ASTPointer<SourceUnit> Parser::parse(shared_ptr<Scanner> const& _scanner)
} }
catch (FatalError const& _error) catch (FatalError const& _error)
{ {
return nullptr; if (m_errors.empty())
} throw; // Something is weird here, rather throw again.
catch(Exception const& _e)
{
return nullptr; return nullptr;
} }
} }