aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-02-21 14:21:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-02-21 14:21:23 +0200
commit73386de65fd49e7690da5203074a5ea603551db6 (patch)
tree502d1504101cc96a9cc46e1171dcb4cae3a19850 /libbuild2/variable.cxx
parent94b6103c6c3475e3bf10eb905d504a5d239305b7 (diff)
Fix issue with json null representation in containers
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r--libbuild2/variable.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index ab65237..078c13a 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -1799,9 +1799,16 @@ namespace build2
{
case json_type::null:
{
- // Return empty to be consistent with other places.
+ // Note that here we cannot return empty (e.g., to be consistent with
+ // other places) because we treat empty name (as opposed to empty
+ // names) as string, not null (see to_json_value() above).
//
-#if 0
+ // Thankfully this version of reverse() is only used when json_value
+ // representation is needed as part of a container. Which means in
+ // "consumption" contexts (e.g., result of subscript) null will still
+ // decay to empty.
+ //
+#if 1
return name ("null");
#else
return name ();