Set handlers use unified jsonPrint with prettifier if needed

This commit is contained in:
Aisultan Kali
2022-04-04 20:17:11 +02:00
committed by wechman
parent 1bc1f8bdbb
commit 96376264e8
36 changed files with 333 additions and 19 deletions
+2 -2
View File
@@ -190,9 +190,9 @@ Json::Value ASTJsonConverter::inlineAssemblyIdentifierToJson(pair<yul::Identifie
return tuple;
}
void ASTJsonConverter::print(ostream& _stream, ASTNode const& _node)
void ASTJsonConverter::print(ostream& _stream, ASTNode const& _node, util::JsonFormat const& _format)
{
_stream << util::jsonPrettyPrint(toJson(_node));
_stream << util::jsonPrint(toJson(_node), _format);
}
Json::Value ASTJsonConverter::toJson(ASTNode const& _node)
+2 -1
View File
@@ -29,6 +29,7 @@
#include <liblangutil/Exceptions.h>
#include <json/json.h>
#include <libsolutil/JSON.h>
#include <algorithm>
#include <optional>
@@ -58,7 +59,7 @@ public:
std::map<std::string, unsigned> _sourceIndices = std::map<std::string, unsigned>()
);
/// Output the json representation of the AST to _stream.
void print(std::ostream& _stream, ASTNode const& _node);
void print(std::ostream& _stream, ASTNode const& _node, util::JsonFormat const& _format);
Json::Value toJson(ASTNode const& _node);
template <class T>
Json::Value toJson(std::vector<ASTPointer<T>> const& _nodes)