documentation, checks and renaming

This commit is contained in:
djuju 2017-04-27 12:56:56 +02:00
parent 99a7aefb75
commit 5fd7942173
2 changed files with 13 additions and 14 deletions

View File

@ -57,7 +57,7 @@ using namespace dev;
using namespace dev::solidity;
CompilerStack::CompilerStack(ReadFile::Callback const& _readFile):
m_readFile(_readFile), m_parseSuccessful(false) {}
m_readFile(_readFile), m_success(false) {}
void CompilerStack::setRemappings(vector<string> const& _remappings)
{
@ -79,7 +79,7 @@ void CompilerStack::setRemappings(vector<string> const& _remappings)
void CompilerStack::reset(bool _keepSources)
{
m_parseSuccessful = false;
m_success = false;
if (_keepSources)
for (auto sourcePair: m_sources)
sourcePair.second.reset();
@ -116,7 +116,7 @@ bool CompilerStack::parse()
//reset
m_errors.clear();
ASTNode::resetID();
m_parseSuccessful = false;
m_success = false;
if (SemVerVersion{string(VersionString)}.isPrerelease())
{
@ -148,8 +148,7 @@ bool CompilerStack::parse()
}
}
}
m_parseSuccessful = Error::containsOnlyWarnings(m_errors);
return m_parseSuccessful;
return Error::containsOnlyWarnings(m_errors);
}
bool CompilerStack::analyze()
@ -241,8 +240,8 @@ bool CompilerStack::analyze()
noErrors = false;
}
m_parseSuccessful = noErrors;
return m_parseSuccessful;
m_success = noErrors;
return m_success;
}
bool CompilerStack::parse(string const& _sourceCode)
@ -264,7 +263,7 @@ bool CompilerStack::parseAndAnalyze(std::string const& _sourceCode)
vector<string> CompilerStack::contractNames() const
{
if (!m_parseSuccessful)
if (!m_success)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
vector<string> contractNames;
for (auto const& contract: m_contracts)
@ -275,7 +274,7 @@ vector<string> CompilerStack::contractNames() const
bool CompilerStack::compile(bool _optimize, unsigned _runs, map<string, h160> const& _libraries)
{
if (!m_parseSuccessful)
if (!m_success)
if (!parseAndAnalyze())
return false;
@ -436,7 +435,7 @@ Json::Value const& CompilerStack::interface(string const& _contractName) const
Json::Value const& CompilerStack::metadata(string const& _contractName, DocumentationType _type) const
{
if (!m_parseSuccessful)
if (!m_success)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
return metadata(contract(_contractName), _type);
@ -444,7 +443,7 @@ Json::Value const& CompilerStack::metadata(string const& _contractName, Document
Json::Value const& CompilerStack::metadata(Contract const& _contract, DocumentationType _type) const
{
if (!m_parseSuccessful)
if (!m_success)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
solAssert(_contract.contract, "");
@ -475,7 +474,7 @@ Json::Value const& CompilerStack::metadata(Contract const& _contract, Documentat
string const& CompilerStack::onChainMetadata(string const& _contractName) const
{
if (!m_parseSuccessful)
if (!m_success)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
return contract(_contractName).onChainMetadata;

View File

@ -104,7 +104,7 @@ public:
/// @returns false on error.
bool parse(std::string const& _sourceCode);
/// performs the analyisis steps (imports, scopesetting, syntaxCheck, referenceResolving,
/// typechecking, staticAnalysis) on the set sources
/// typechecking, staticAnalysis) on previously set sources
/// @returns false on error.
bool analyze();
/// Parses and analyzes all source units that were added
@ -276,7 +276,7 @@ private:
/// list of path prefix remappings, e.g. mylibrary: github.com/ethereum = /usr/local/ethereum
/// "context:prefix=target"
std::vector<Remapping> m_remappings;
bool m_parseSuccessful;
bool m_success;
std::map<std::string const, Source> m_sources;
std::shared_ptr<GlobalContext> m_globalContext;
std::map<ASTNode const*, std::shared_ptr<DeclarationContainer>> m_scopes;