Fixed a bug in the compiler that caused problems with loop not being referenced in an outer scoped. (Introduced in the last checkin)
--HG--
branch : trunk
diff --git a/tests/test_forloop.py b/tests/test_forloop.py
index a4f057c..0c307ec 100644
--- a/tests/test_forloop.py
+++ b/tests/test_forloop.py
@@ -144,3 +144,12 @@
t = env.from_string('{% for s in seq %}[{{ loop.first }}{% for c in s %}'
'|{{ loop.first }}{% endfor %}]{% endfor %}')
assert t.render(seq=('ab', 'cd')) == '[True|True|False][False|True|False]'
+
+
+def test_scoped_loop_var(env):
+ t = env.from_string('{% for x in seq %}{{ loop.first }}'
+ '{% for y in seq %}{% endfor %}{% endfor %}')
+ assert t.render(seq='ab') == 'TrueFalse'
+ t = env.from_string('{% for x in seq %}{% for y in seq %}'
+ '{{ loop.first }}{% endfor %}{% endfor %}')
+ assert t.render(seq='ab') == 'TrueFalseTrueFalse'