aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-18 21:43:10 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-18 21:44:19 +0800
commit33ac1f29b52734d3761189182094eeec9f52b4ac (patch)
tree2acbc9bc7fae3fdcf53fea91762a2a25820f3c3e /libsolidity
parent7b0f8774211101c78a0540e0525a2bc4f875deea (diff)
downloaddexon-solidity-33ac1f29b52734d3761189182094eeec9f52b4ac.tar.gz
dexon-solidity-33ac1f29b52734d3761189182094eeec9f52b4ac.tar.zst
dexon-solidity-33ac1f29b52734d3761189182094eeec9f52b4ac.zip
Reorder code for readability
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/StandardCompiler.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 15bb7592..06bf9e52 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -352,11 +352,6 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
));
}
- Json::Value output = Json::objectValue;
-
- if (errors.size() > 0)
- output["errors"] = errors;
-
bool analysisSuccess = m_compilerStack.state() >= CompilerStack::State::AnalysisSuccessful;
bool compilationSuccess = m_compilerStack.state() == CompilerStack::State::CompilationSuccessful;
@@ -364,15 +359,20 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
if (!compilationSuccess && (errors.size() == 0))
return formatFatalError("InternalCompilerError", "No error reported, but compilation failed.");
+ Json::Value output = Json::objectValue;
+
+ if (errors.size() > 0)
+ output["errors"] = errors;
+
output["sources"] = Json::objectValue;
unsigned sourceIndex = 0;
- for (auto const& source: analysisSuccess ? m_compilerStack.sourceNames() : vector<string>())
+ for (string const& sourceName: analysisSuccess ? m_compilerStack.sourceNames() : vector<string>())
{
Json::Value sourceResult = Json::objectValue;
sourceResult["id"] = sourceIndex++;
- sourceResult["ast"] = ASTJsonConverter(false, m_compilerStack.sourceIndices()).toJson(m_compilerStack.ast(source));
- sourceResult["legacyAST"] = ASTJsonConverter(true, m_compilerStack.sourceIndices()).toJson(m_compilerStack.ast(source));
- output["sources"][source] = sourceResult;
+ sourceResult["ast"] = ASTJsonConverter(false, m_compilerStack.sourceIndices()).toJson(m_compilerStack.ast(sourceName));
+ sourceResult["legacyAST"] = ASTJsonConverter(true, m_compilerStack.sourceIndices()).toJson(m_compilerStack.ast(sourceName));
+ output["sources"][sourceName] = sourceResult;
}
Json::Value contractsOutput = Json::objectValue;