From eb70bb9b87b2d770cd1913c4f7464e3730fdb431 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Tue, 21 Jun 2022 15:19:56 -0400 Subject: [PATCH] Refactor Liquid::Variable to respect disabling liquid-c nodes (#1584) parse_context.parse_expression is overriden in liquid-c and will avoid parsing to a Liquid::C::Expression when parsing with `disable_liquid_c_nodes: true` --- lib/liquid/variable.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/liquid/variable.rb b/lib/liquid/variable.rb index 95446e17..1a4c0719 100644 --- a/lib/liquid/variable.rb +++ b/lib/liquid/variable.rb @@ -47,7 +47,7 @@ module Liquid name_markup = Regexp.last_match(1) filter_markup = Regexp.last_match(2) - @name = Expression.parse(name_markup) + @name = parse_context.parse_expression(name_markup) if filter_markup =~ FilterMarkupRegex filters = Regexp.last_match(1).scan(FilterParser) filters.each do |f| @@ -65,7 +65,7 @@ module Liquid return if p.look(:end_of_string) - @name = Expression.parse(p.expression) + @name = parse_context.parse_expression(p.expression) while p.consume?(:pipe) filtername = p.consume(:id) filterargs = p.consume?(:colon) ? parse_filterargs(p) : [] @@ -122,9 +122,9 @@ module Liquid unparsed_args.each do |a| if (matches = a.match(JustTagAttributes)) keyword_args ||= {} - keyword_args[matches[1]] = Expression.parse(matches[2]) + keyword_args[matches[1]] = parse_context.parse_expression(matches[2]) else - filter_args << Expression.parse(a) + filter_args << parse_context.parse_expression(a) end end result = [filter_name, filter_args]