From ac2974380f1986480b3a974d97dd120f81c3e2af Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Feb 2024 15:35:07 +0200 Subject: Add support for nested subscript, use for json access --- libbuild2/variable.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libbuild2/variable.cxx') 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::value_type; + + return r; } void json_iterate (const value& val, -- cgit v1.1