diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-11 15:01:39 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-11 15:02:03 +0800 |
commit | c0f31e4c1b79854bb5960dfe45bcecb907d63f84 (patch) | |
tree | 4853473f6909909a939682c5dd624bae0e6ea791 /libsolidity | |
parent | 5b4b620d8b2a36f5e76ffbca16a2d3d5d7253c45 (diff) | |
download | dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar.gz dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar.bz2 dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar.lz dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar.xz dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.tar.zst dexon-solidity-c0f31e4c1b79854bb5960dfe45bcecb907d63f84.zip |
Ensure proper checks are in CompilerStack
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index c4e60fd7..5c836358 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -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) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful.")); - return metadata(contract(_contractName), _type); } @@ -491,13 +488,16 @@ 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; } @@ -511,6 +511,9 @@ SourceUnit const& CompilerStack::ast(string const& _sourceName) const 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; } @@ -739,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(); } |