aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-03 19:02:06 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-03 19:06:41 +0800
commit75c193e9595c290967d14a5e203f0a6192c10aa2 (patch)
tree0edbe11c524b55e1dfd8da917601eeda4e390926 /libsolidity
parent08069bf4a426247d8fa6fb0e1a2002a9ea2f9ded (diff)
downloaddexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar.gz
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar.bz2
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar.lz
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar.xz
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.tar.zst
dexon-solidity-75c193e9595c290967d14a5e203f0a6192c10aa2.zip
Use more refined states in StandardCompiler
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 2e5005b8..e677afc8 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -265,11 +265,9 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return m_compilerStack.scanner(_sourceName); };
- bool success = false;
-
try
{
- success = m_compilerStack.compile(optimize, optimizeRuns, libraries);
+ m_compilerStack.compile(optimize, optimizeRuns, libraries);
for (auto const& error: m_compilerStack.errors())
{
@@ -359,13 +357,16 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
if (errors.size() > 0)
output["errors"] = errors;
+ bool parsingSuccess = m_compilerStack.state() >= CompilerStack::State::ParsingSuccessful;
+ bool compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful;
+
/// Inconsistent state - stop here to receive error reports from users
- if (!success && (errors.size() == 0))
+ if (!compilationSuccess && (errors.size() == 0))
return formatFatalError("InternalCompilerError", "No error reported, but compilation failed.");
output["sources"] = Json::objectValue;
unsigned sourceIndex = 0;
- for (auto const& source: m_compilerStack.sourceNames())
+ for (auto const& source: parsingSuccess ? m_compilerStack.sourceNames() : vector<string>())
{
Json::Value sourceResult = Json::objectValue;
sourceResult["id"] = sourceIndex++;
@@ -375,7 +376,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
}
Json::Value contractsOutput = Json::objectValue;
- for (string const& contractName: success ? m_compilerStack.contractNames() : vector<string>())
+ for (string const& contractName: compilationSuccess ? m_compilerStack.contractNames() : vector<string>())
{
size_t colon = contractName.find(':');
solAssert(colon != string::npos, "");