jinja : skip copying loop scope unless a loop filter needs it (#29776)

This commit is contained in:
a u s t i n authored and GitHub committed 2026-10-01 10:10:57 +02:00
1 parent 32dd62ee6d
commit def4d406ae
1 file changed
+1 -2
+1 -2
View File
@@ -537,8 +537,6 @@ value for_statement::execute_impl(context & ctx) const {
std::vector<value> filtered_items;
for (size_t i = 0; i < items.size(); ++i) {
context loop_scope(scope);
value current = items[i];
std::function<void(context&)> scope_update_fn = [](context &) { /* no-op */};
@@ -584,6 +582,7 @@ value for_statement::execute_impl(context & ctx) const {
}
if (select_expr && test_expr) {
context loop_scope(scope);
scope_update_fn(loop_scope);
value test_val = test_expr->execute(loop_scope);
if (!test_val->as_bool()) {