mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Fix behaviour of Context#stack when Context#push raises.
We only want to pop the scope at the end of the method if pushing it succeeded, so the push needs to be outside the block with the ensure.
This commit is contained in:
@@ -88,9 +88,12 @@ module Liquid
|
||||
# context['var] #=> nil
|
||||
def stack(new_scope={})
|
||||
push(new_scope)
|
||||
yield
|
||||
ensure
|
||||
pop
|
||||
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
pop
|
||||
end
|
||||
end
|
||||
|
||||
def clear_instance_assigns
|
||||
|
||||
Reference in New Issue
Block a user