aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-04-24 23:12:37 +0800
committerGitHub <noreply@github.com>2017-04-24 23:12:37 +0800
commitd3b8d5f0498724fc4271f907f0404b4ed7922399 (patch)
tree31250578aa02cc6d0a3c1286e5b487be0cb24085
parent2c3fea55df4e7eff6df515c19f5f80737e829bcf (diff)
parent43eb8398711f7fafd703cff06092f3dfd2b0e748 (diff)
downloaddexon-solidity-d3b8d5f0498724fc4271f907f0404b4ed7922399.tar.gz
dexon-solidity-d3b8d5f0498724fc4271f907f0404b4ed7922399.tar.zst
dexon-solidity-d3b8d5f0498724fc4271f907f0404b4ed7922399.zip
Merge pull request #2161 from ethereum/jsonio-cleanup
Small cleanups to JSON IO
-rw-r--r--docs/using-the-compiler.rst6
-rw-r--r--libsolidity/interface/Exceptions.cpp12
-rw-r--r--libsolidity/interface/StandardCompiler.cpp8
3 files changed, 14 insertions, 12 deletions
diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst
index 9e9a5eb6..deaa1329 100644
--- a/docs/using-the-compiler.rst
+++ b/docs/using-the-compiler.rst
@@ -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 ``--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 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,
some fields are optional (as noted), but it is aimed at to only make backwards compatible changes.
diff --git a/libsolidity/interface/Exceptions.cpp b/libsolidity/interface/Exceptions.cpp
index 968a24ad..c09180de 100644
--- a/libsolidity/interface/Exceptions.cpp
+++ b/libsolidity/interface/Exceptions.cpp
@@ -33,22 +33,22 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip
switch(m_type)
{
case Type::DeclarationError:
- m_typeName = "Declaration Error";
+ m_typeName = "DeclarationError";
break;
case Type::DocstringParsingError:
- m_typeName = "Docstring Parsing Error";
+ m_typeName = "DocstringParsingError";
break;
case Type::ParserError:
- m_typeName = "Parser Error";
+ m_typeName = "ParserError";
break;
case Type::SyntaxError:
- m_typeName = "Syntax Error";
+ m_typeName = "SyntaxError";
break;
case Type::TypeError:
- m_typeName = "Type Error";
+ m_typeName = "TypeError";
break;
case Type::Why3TranslatorError:
- m_typeName = "Why3 Translator Error";
+ m_typeName = "Why3TranslatorError";
break;
case Type::Warning:
m_typeName = "Warning";
diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp
index 582765e7..2b280dd5 100644
--- a/libsolidity/interface/StandardCompiler.cpp
+++ b/libsolidity/interface/StandardCompiler.cpp
@@ -378,7 +378,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
}
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(':');
solAssert(colon != string::npos, "");
@@ -454,9 +454,13 @@ Json::Value StandardCompiler::compile(Json::Value const& _input)
{
return compileInternal(_input);
}
+ catch (Exception const& _exception)
+ {
+ return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compileInternal: " + boost::diagnostic_information(_exception));
+ }
catch (...)
{
- return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compilerInternal");
+ return formatFatalError("InternalCompilerError", "Internal exception in StandardCompiler::compileInternal");
}
}