From 63b5b6416c6bde16560eb9b83a9e3122599369d5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 14 Oct 2022 16:06:35 +0300 Subject: Fix 'for [] x: ...' to treat as value attributes --- libbuild2/script/parser.cxx | 9 ++++++--- libbuild2/script/parser.hxx | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'libbuild2/script') diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index a2e0819..87a51d8 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -2587,6 +2587,11 @@ namespace build2 next_with_attributes (t, tt); attributes_push (t, tt); + // @@ TMP Currently we assume that these are the value (rather + // than the variable) attributes. + // + attributes val_attrs (attributes_pop ()); + assert (tt == type::word && t.qtype == quote_type::unquoted); string vn (move (t.value)); @@ -2604,8 +2609,6 @@ namespace build2 var = &var_pool->insert (move (vn)); } - apply_variable_attributes (*var); - next (t, tt); // Skip the colon. assert (tt == type::colon); @@ -2664,7 +2667,7 @@ namespace build2 if (etype != nullptr) typify (v, *etype, var); - exec_for (*var, move (v), ll); + exec_for (*var, move (v), val_attrs, ll); // Find the construct end, if it is not found yet. // diff --git a/libbuild2/script/parser.hxx b/libbuild2/script/parser.hxx index c402d3e..91f50bf 100644 --- a/libbuild2/script/parser.hxx +++ b/libbuild2/script/parser.hxx @@ -202,6 +202,7 @@ namespace build2 using exec_for_function = void (const variable&, value&&, + const attributes& value_attrs, const location&); // If a parser implementation doesn't pre-enter variables into a pool -- cgit v1.1