mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Remove now unnecessary squash_instance_assigns_with_environments
Since it was just there to make sure instance assigns were overriden when rending more than once with the same template instance. It is no longer necessary because the template no longer stores instance_assigns which need to be overriden.
This commit is contained in:
@@ -34,7 +34,6 @@ module Liquid
|
||||
@strict_variables = false
|
||||
@resource_limits = resource_limits || ResourceLimits.new(Template.default_resource_limits)
|
||||
@base_scope_depth = 0
|
||||
squash_instance_assigns_with_environments
|
||||
|
||||
self.exception_renderer = Template.default_exception_renderer
|
||||
if rethrow_errors
|
||||
@@ -246,16 +245,5 @@ module Liquid
|
||||
rescue Liquid::InternalError => exc
|
||||
exc
|
||||
end
|
||||
|
||||
def squash_instance_assigns_with_environments
|
||||
@scopes.last.each_key do |k|
|
||||
@environments.each do |env|
|
||||
if env.key?(k)
|
||||
scopes.last[k] = lookup_and_evaluate(env, k)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end # squash_instance_assigns_with_environments
|
||||
end # Context
|
||||
end # Liquid
|
||||
|
||||
@@ -52,10 +52,7 @@ class TemplateTest < Minitest::Test
|
||||
t = Template.new
|
||||
assert_equal('from custom assigns', t.parse("{{ foo }}").render!('foo' => 'from custom assigns'))
|
||||
assert_equal('', t.parse("{{ foo }}").render!)
|
||||
end
|
||||
|
||||
def test_custom_assigns_squash_instance_assigns
|
||||
t = Template.new
|
||||
assert_equal('from instance assigns', t.parse("{% assign foo = 'from instance assigns' %}{{ foo }}").render!)
|
||||
assert_equal('from custom assigns', t.parse("{{ foo }}").render!('foo' => 'from custom assigns'))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user