Merge pull request #2161 from ethereum/jsonio-cleanup

Small cleanups to JSON IO
This commit is contained in:
chriseth 2017-04-24 17:12:37 +02:00 committed by GitHub
commit d3b8d5f049
3 changed files with 14 additions and 12 deletions

View File

@ -37,15 +37,13 @@ Either add ``--libraries "Math:0x12345678901234567890 Heap:0xabcdef0123456"`` to
If ``solc`` is called with the option ``--link``, all input files are interpreted to be unlinked binaries (hex-encoded) in the ``__LibraryName____``-format given above and are linked in-place (if the input is read from stdin, it is written to stdout). All options except ``--libraries`` are ignored (including ``-o``) in this case. If ``solc`` is called with the option ``--link``, all input files are interpreted to be unlinked binaries (hex-encoded) in the ``__LibraryName____``-format given above and are linked in-place (if the input is read from stdin, it is written to stdout). All options except ``--libraries`` are ignored (including ``-o``) in this case.
If ``solc`` is called with the option ``--standard-json``, it will expect a JSON input (as explained below) on the standard input, and return a JSON output on the standard output.
.. _compiler-api: .. _compiler-api:
Compiler Input and Output JSON Description Compiler Input and Output JSON Description
****************************************** ******************************************
.. warning::
This JSON interface is not yet supported by the Solidity compiler, but will be released in a future version.
These JSON formats are used by the compiler API as well as are available through ``solc``. These are subject to change, These JSON formats are used by the compiler API as well as are available through ``solc``. These are subject to change,
some fields are optional (as noted), but it is aimed at to only make backwards compatible changes. some fields are optional (as noted), but it is aimed at to only make backwards compatible changes.

View File

@ -378,7 +378,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
} }
Json::Value contractsOutput = Json::objectValue; Json::Value contractsOutput = Json::objectValue;
for (string const& contractName: m_compilerStack.contractNames()) for (string const& contractName: success ? m_compilerStack.contractNames() : vector<string>())
{ {
size_t colon = contractName.find(':'); size_t colon = contractName.find(':');
solAssert(colon != string::npos, ""); solAssert(colon != string::npos, "");
@ -454,9 +454,13 @@ Json::Value StandardCompiler::compile(Json::Value const& _input)
{ {
return compileInternal(_input); return compileInternal(_input);
} }
catch (Exception const& _exception)
{
return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compileInternal: " + boost::diagnostic_information(_exception));
}
catch (...) catch (...)
{ {
return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compilerInternal"); return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compileInternal");
} }
} }