aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-02-06 15:35:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-02-07 15:02:57 +0200
commitac2974380f1986480b3a974d97dd120f81c3e2af (patch)
tree336820da30501602ae7c27ef20e0cb39ea13acad /libbuild2/variable.cxx
parent36d6b4e5549dc45baf890105de5ef487211f0144 (diff)
Add support for nested subscript, use for json access
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r--libbuild2/variable.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx
index b0fe32a..1785e56 100644
--- a/libbuild2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -2080,9 +2080,16 @@ namespace build2
}
}
- return (jv != nullptr
- ? json_subscript_impl (val, val_data, i, n, index)
- : value ());
+ value r (jv != nullptr
+ ? json_subscript_impl (val, val_data, i, n, index)
+ : value ());
+
+ // Typify null values so that we get called for nested subscripts.
+ //
+ if (r.null)
+ r.type = &value_traits<json_value>::value_type;
+
+ return r;
}
void json_iterate (const value& val,