From 895e63e40a3d50215c9bdb31dd1c5a355136f460 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 22 Jul 2020 15:02:01 -0400 Subject: [PATCH] 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. --- lib/liquid/context.rb | 12 ------------ test/integration/template_test.rb | 3 --- 2 files changed, 15 deletions(-) diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 0737f744..2dcb60cf 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -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 diff --git a/test/integration/template_test.rb b/test/integration/template_test.rb index acac7f38..28536de7 100644 --- a/test/integration/template_test.rb +++ b/test/integration/template_test.rb @@ -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