Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,6 @@ Json::Value const& CompilerStack::interface(string const& _contractName) const

Json::Value const& CompilerStack::metadata(string const& _contractName, DocumentationType _type) const
{
if (m_stackState < AnalysisSuccessful)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed as it is checked in metadata(Contract).

BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));

return metadata(contract(_contractName), _type);
}

Expand Down Expand Up @@ -491,23 +488,32 @@ Json::Value const& CompilerStack::metadata(Contract const& _contract, Documentat
string const& CompilerStack::onChainMetadata(string const& _contractName) const
{
if (m_stackState != CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));

return contract(_contractName).onChainMetadata;
}

Scanner const& CompilerStack::scanner(string const& _sourceName) const
{
if (m_stackState < ParsingSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));

return *source(_sourceName).scanner;
}

SourceUnit const& CompilerStack::ast(string const& _sourceName) const
{
if (m_stackState < ParsingSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));

return *source(_sourceName).ast;
}

ContractDefinition const& CompilerStack::contractDefinition(string const& _contractName) const
{
if (m_stackState != CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));

return *contract(_contractName).contract;
}

Expand Down Expand Up @@ -736,6 +742,9 @@ void CompilerStack::compileContract(

std::string CompilerStack::defaultContractName() const
{
if (m_stackState != CompilationSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Compilation was not successful."));

return contract("").contract->name();
}

Expand Down