aboutsummaryrefslogtreecommitdiffstats
path: root/libsolc
diff options
context:
space:
mode:
authorAlexander Arlt <alexander.arlt@arlt-labs.com>2018-02-07 09:05:20 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-02-21 04:58:26 +0800
commit0f29ac4e563f60be781b31ed9ef2693e1a19dcc8 (patch)
tree888d535ad5698b41f6979622040c3dcce3d300ca /libsolc
parentdcc4083b231e3574a64b5b2a329a7401677610da (diff)
downloaddexon-solidity-0f29ac4e563f60be781b31ed9ef2693e1a19dcc8.tar.gz
dexon-solidity-0f29ac4e563f60be781b31ed9ef2693e1a19dcc8.tar.zst
dexon-solidity-0f29ac4e563f60be781b31ed9ef2693e1a19dcc8.zip
Add new JSON API for better abstraction and for supporting strict JSON parsing
Diffstat (limited to 'libsolc')
-rw-r--r--libsolc/libsolc.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/libsolc/libsolc.cpp b/libsolc/libsolc.cpp
index 3a6e1521..6c587e23 100644
--- a/libsolc/libsolc.cpp
+++ b/libsolc/libsolc.cpp
@@ -203,7 +203,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
{
Json::Value contractInput = ret["contracts"][sourceName][contractName];
Json::Value contractOutput = Json::objectValue;
- contractOutput["interface"] = dev::jsonCompactPrint(contractInput["abi"]);
+ contractOutput["interface"] = jsonCompactPrint(contractInput["abi"]);
contractOutput["metadata"] = contractInput["metadata"];
contractOutput["functionHashes"] = contractInput["evm"]["methodIdentifiers"];
contractOutput["gasEstimates"] = translateGasEstimates(contractInput["evm"]["gasEstimates"]);
@@ -219,7 +219,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
try
{
- return dev::jsonCompactPrint(output);
+ return jsonCompactPrint(output);
}
catch (...)
{
@@ -229,15 +229,15 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
string compileMulti(string const& _input, bool _optimize, CStyleReadFileCallback _readCallback = nullptr)
{
- Json::Reader reader;
+ string errors;
Json::Value input;
- if (!reader.parse(_input, input, false))
+ if (!jsonParseStrict(_input, input, &errors))
{
- Json::Value errors(Json::arrayValue);
- errors.append("Error parsing input JSON: " + reader.getFormattedErrorMessages());
+ Json::Value jsonErrors(Json::arrayValue);
+ jsonErrors.append("Error parsing input JSON: " + errors);
Json::Value output(Json::objectValue);
- output["errors"] = errors;
- return dev::jsonCompactPrint(output);
+ output["errors"] = jsonErrors;
+ return jsonCompactPrint(output);
}
else
{