Removed null members from JSON output

This commit is contained in:
hrkrshnn
2020-05-20 16:56:33 +05:30
committed by Harikrishnan Mulackal
parent d422a406ba
commit 4a001d568e
95 changed files with 106 additions and 733 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair<yul::Identifie
void ASTJsonConverter::print(ostream& _stream, ASTNode const& _node)
{
_stream << util::jsonPrettyPrint(toJson(_node));
_stream << util::jsonPrettyPrint(util::removeNullMembers(toJson(_node)));
}
Json::Value&& ASTJsonConverter::toJson(ASTNode const& _node)
+2 -1
View File
@@ -884,7 +884,8 @@ ASTPointer<StructuredDocumentation> ASTJsonImporter::createDocumentation(Json::V
Json::Value ASTJsonImporter::member(Json::Value const& _node, string const& _name)
{
astAssert(_node.isMember(_name), "Node '" + _node["nodeType"].asString() + "' (id " + _node["id"].asString() + ") is missing field '" + _name + "'.");
if (!_node.isMember(_name))
return Json::nullValue;
return _node[_name];
}
+2 -1
View File
@@ -63,7 +63,8 @@ T AsmJsonImporter::createAsmNode(Json::Value const& _node)
Json::Value AsmJsonImporter::member(Json::Value const& _node, string const& _name)
{
astAssert(_node.isMember(_name), "Node is missing field '" + _name + "'.");
if (!_node.isMember(_name))
return Json::nullValue;
return _node[_name];
}