mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-17 01:40:42 -07:00
Cache SelfDrop per context
This commit is contained in:
@@ -208,7 +208,7 @@ module Liquid
|
||||
|
||||
# `self` resolves to a SelfDrop (enabling `self['var']` lookups),
|
||||
# but only when it hasn't been explicitly assigned as a local variable.
|
||||
return SelfDrop.new(self) if key == Expression::SELF && !index
|
||||
return @self_drop ||= SelfDrop.new(self) if key == Expression::SELF && !index
|
||||
|
||||
variable = if index
|
||||
lookup_and_evaluate(@scopes[index], key, raise_on_not_found: raise_on_not_found)
|
||||
|
||||
Reference in New Issue
Block a user