mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reorder code for readability
This commit is contained in:
parent
7b0f877421
commit
33ac1f29b5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user