From 619def44c1cca9f3cdf63544d5f24f2c7a7d9b77 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 22 Feb 2022 17:03:21 +0100 Subject: Initial self-hosting commit This is the initial version of our tool that is able to build itself. In can be bootstrapped by ./bin/bootstrap.py Co-authored-by: Oliver Reiche Co-authored-by: Victor Moreno --- .../build_engine/expression/target_node.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/buildtool/build_engine/expression/target_node.cpp (limited to 'src/buildtool/build_engine/expression/target_node.cpp') diff --git a/src/buildtool/build_engine/expression/target_node.cpp b/src/buildtool/build_engine/expression/target_node.cpp new file mode 100644 index 00000000..03fc47f5 --- /dev/null +++ b/src/buildtool/build_engine/expression/target_node.cpp @@ -0,0 +1,20 @@ +#include "src/buildtool/build_engine/expression/target_node.hpp" + +#include "src/buildtool/build_engine/expression/expression.hpp" + +auto TargetNode::Abstract::IsCacheable() const noexcept -> bool { + return target_fields->IsCacheable(); +} + +auto TargetNode::ToJson() const -> nlohmann::json { + if (IsValue()) { + return {{"type", "VALUE_NODE"}, {"result", GetValue()->ToJson()}}; + } + auto const& data = GetAbstract(); + return {{"type", "ABSTRACT_NODE"}, + {"node_type", data.node_type}, + {"string_fields", data.string_fields->ToJson()}, + {"target_fields", + data.target_fields->ToJson( + Expression::JsonMode::SerializeAllButNodes)}}; +} -- cgit v1.2.3