diff --git a/common/jinja/runtime.cpp b/common/jinja/runtime.cpp index a44d63c0c..b8a69995b 100644 --- a/common/jinja/runtime.cpp +++ b/common/jinja/runtime.cpp @@ -537,8 +537,6 @@ value for_statement::execute_impl(context & ctx) const { std::vector filtered_items; for (size_t i = 0; i < items.size(); ++i) { - context loop_scope(scope); - value current = items[i]; std::function 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()) {