diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-16 01:33:28 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-11-16 01:38:18 +0800 |
commit | 81c50143f2bff6f589ab1237d68c8820107f18b9 (patch) | |
tree | 749c4e932d32aebee20f54065d9962a7ee526582 /solc/jsonCompiler.cpp | |
parent | 9205662de9416ab160db7327a6022ea8b1fba3e1 (diff) | |
download | dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar.gz dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar.bz2 dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar.lz dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar.xz dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.tar.zst dexon-solidity-81c50143f2bff6f589ab1237d68c8820107f18b9.zip |
Move JSON helpers to libdevcore/json
Diffstat (limited to 'solc/jsonCompiler.cpp')
-rw-r--r-- | solc/jsonCompiler.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index 52f796a5..771f0df8 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -27,6 +27,7 @@ #include <libdevcore/Common.h> #include <libdevcore/CommonData.h> #include <libdevcore/CommonIO.h> +#include <libdevcore/JSON.h> #include <libevmasm/Instruction.h> #include <libevmasm/GasMeter.h> #include <libsolidity/parsing/Scanner.h> @@ -125,13 +126,6 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract) return gasEstimates; } -string jsonCompactPrint(Json::Value const& input) -{ - Json::FastWriter writer; - writer.omitEndingLineFeed(); - return writer.write(input); -} - string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback _readCallback) { Json::Value output(Json::objectValue); @@ -220,7 +214,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback for (string const& contractName: compiler.contractNames()) { Json::Value contractData(Json::objectValue); - contractData["interface"] = jsonCompactPrint(compiler.interface(contractName)); + contractData["interface"] = dev::jsonCompactPrint(compiler.interface(contractName)); contractData["bytecode"] = compiler.object(contractName).toHex(); contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex(); contractData["opcodes"] = solidity::disassemble(compiler.object(contractName).bytecode); @@ -281,7 +275,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback try { - return jsonCompactPrint(output); + return dev::jsonCompactPrint(output); } catch (...) { @@ -299,7 +293,7 @@ string compileMulti(string const& _input, bool _optimize, CStyleReadFileCallback errors.append("Error parsing input JSON: " + reader.getFormattedErrorMessages()); Json::Value output(Json::objectValue); output["errors"] = errors; - return jsonCompactPrint(output); + return dev::jsonCompactPrint(output); } else { |