Skip to content

Commit fd6cc96

Browse files
author
Youssef Makboul
committed
Disable ruby fallback
1 parent ea24277 commit fd6cc96

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

lib/liquid/c.rb

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,9 @@ def new_block_body
7373

7474
alias_method :ruby_new_tokenizer, :new_tokenizer
7575
def new_tokenizer(source, start_line_number: nil, for_liquid_tag: false)
76-
unless liquid_c_nodes_disabled?
77-
source = source.to_s.to_str
78-
if source.bytesize <= Liquid::C::Tokenizer::MAX_SOURCE_BYTE_SIZE
79-
source = source.encode(Encoding::UTF_8)
80-
return Liquid::C::Tokenizer.new(source, start_line_number || 0, for_liquid_tag)
81-
else
82-
@liquid_c_nodes_disabled = true
83-
end
84-
end
85-
86-
ruby_new_tokenizer(source, start_line_number: start_line_number, for_liquid_tag: for_liquid_tag)
76+
source = source.to_s.to_str
77+
source = source.encode(Encoding::UTF_8)
78+
Liquid::C::Tokenizer.new(source, start_line_number || 0, for_liquid_tag)
8779
end
8880

8981
def parse_expression(markup)
@@ -96,15 +88,7 @@ def parse_expression(markup)
9688

9789
# @api private
9890
def liquid_c_nodes_disabled?
99-
# Liquid::Profiler exposes the internal parse tree that we don't want to build when
100-
# parsing with liquid-c, so consider liquid-c to be disabled when using it.
101-
# Also, some templates are parsed before the profiler is running, on which case we
102-
# provide the `disable_liquid_c_nodes` option to enable the Ruby AST to be produced
103-
# so the profiler can use it on future runs.
104-
return @liquid_c_nodes_disabled if defined?(@liquid_c_nodes_disabled)
105-
106-
@liquid_c_nodes_disabled = !Liquid::C.enabled || @template_options[:profile] ||
107-
@template_options[:disable_liquid_c_nodes] || self.class.liquid_c_nodes_disabled
91+
false
10892
end
10993
end
11094

0 commit comments

Comments
 (0)