summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/expression/target_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/build_engine/expression/target_node.cpp')
-rw-r--r--src/buildtool/build_engine/expression/target_node.cpp20
1 files changed, 20 insertions, 0 deletions
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)}};
+}