From bd32ea47fd8f720b54f81a769dc007d1fdb4e5c1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 23 Aug 2016 09:05:54 +0200 Subject: Reverse empty simple values as an empty names sequence rather than empty name This way we get: config.import.foo = Rather than: config.import.foo = {} --- build2/variable.txx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'build2/variable.txx') diff --git a/build2/variable.txx b/build2/variable.txx index f1335b4..95e4f0a 100644 --- a/build2/variable.txx +++ b/build2/variable.txx @@ -148,7 +148,21 @@ namespace build2 names_view simple_reverse (const value& v, names& s) { - s.emplace_back (value_traits::reverse (v.as ())); + const T& x (v.as ()); + + // Represent an empty simple value as empty name sequence rather than + // a single empty name. This way, for example, during serialization we + // end up with a much saner looking: + // + // config.import.foo = + // + // Rather than: + // + // config.import.foo = {} + // + if (!value_traits::empty (x)) + s.emplace_back (value_traits::reverse (x)); + return s; } -- cgit v1.1