mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11976 from ethereum/json-cleanup
Some cleanup and testing for JSON
This commit is contained in:
@@ -203,7 +203,7 @@ string Assembly::assemblyString(StringMap const& _sourceCodes) const
|
||||
|
||||
Json::Value Assembly::createJsonValue(string _name, int _source, int _begin, int _end, string _value, string _jumpType)
|
||||
{
|
||||
Json::Value value;
|
||||
Json::Value value{Json::objectValue};
|
||||
value["name"] = _name;
|
||||
value["source"] = _source;
|
||||
value["begin"] = _begin;
|
||||
@@ -225,8 +225,9 @@ string Assembly::toStringInHex(u256 _value)
|
||||
Json::Value Assembly::assemblyJSON(map<string, unsigned> const& _sourceIndices) const
|
||||
{
|
||||
Json::Value root;
|
||||
root[".code"] = Json::arrayValue;
|
||||
|
||||
Json::Value& collection = root[".code"] = Json::arrayValue;
|
||||
Json::Value& collection = root[".code"];
|
||||
for (AssemblyItem const& i: m_items)
|
||||
{
|
||||
int sourceIndex = -1;
|
||||
@@ -320,7 +321,8 @@ Json::Value Assembly::assemblyJSON(map<string, unsigned> const& _sourceIndices)
|
||||
|
||||
if (!m_data.empty() || !m_subs.empty())
|
||||
{
|
||||
Json::Value& data = root[".data"] = Json::objectValue;
|
||||
root[".data"] = Json::objectValue;
|
||||
Json::Value& data = root[".data"];
|
||||
for (auto const& i: m_data)
|
||||
if (u256(i.first) >= m_subs.size())
|
||||
data[toStringInHex((u256)i.first)] = util::toHex(i.second);
|
||||
|
||||
Reference in New Issue
Block a user