Push to for_stack at the beginning of For#render

This commit is contained in:
Justin Li
2015-05-15 23:13:15 -04:00
parent dad98cfc89
commit 070639daba
2 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -70,6 +70,9 @@ module Liquid
for_offsets = context.registers[:for] ||= Hash.new(0)
for_stack = context.registers[:for_stack] ||= []
parent_loop = for_stack.last
for_stack.push(nil)
collection = context.evaluate(@collection_name)
collection = collection.to_a if collection.is_a?(Range)
@@ -98,9 +101,6 @@ module Liquid
# Store our progress through the collection for the continue flag
for_offsets[@name] = from + segment.length
parent_loop = for_stack.last
for_stack.push(nil)
context.stack do
segment.each_with_index do |item, index|
context[@variable_name] = item