From 0aa7a94e1032a96a2a72cb6a82824f9fe970d412 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 14 Dec 2022 14:18:44 +0200 Subject: Improve empty simple value to empty list of names reduction heuristics Specifically, do not reduce typed RHS empty simple values for prepend/append and additionally for assignment provided LHS is typed and is a container. --- libbuild2/variable.ixx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libbuild2/variable.ixx') diff --git a/libbuild2/variable.ixx b/libbuild2/variable.ixx index c9dfad4..c7b1f35 100644 --- a/libbuild2/variable.ixx +++ b/libbuild2/variable.ixx @@ -326,18 +326,21 @@ namespace build2 } inline vector_view - reverse (const value& v, names& storage) + reverse (const value& v, names& storage, bool reduce) { assert (v && storage.empty () && (v.type == nullptr || v.type->reverse != nullptr)); - return v.type == nullptr ? v.as () : v.type->reverse (v, storage); + + return v.type == nullptr + ? v.as () + : v.type->reverse (v, storage, reduce); } inline vector_view - reverse (value& v, names& storage) + reverse (value& v, names& storage, bool reduce) { - names_view cv (reverse (static_cast (v), storage)); + names_view cv (reverse (static_cast (v), storage, reduce)); return vector_view (const_cast (cv.data ()), cv.size ()); } -- cgit v1.1