From 6ad7508ce2d379f1332e82fdcc13d802522ebe0c Mon Sep 17 00:00:00 2001 From: Michael Go Date: Thu, 24 Oct 2024 22:19:41 -0300 Subject: [PATCH] more micro optimization --- lib/liquid/tokenizer.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/liquid/tokenizer.rb b/lib/liquid/tokenizer.rb index fb0cdf69..4f683a27 100644 --- a/lib/liquid/tokenizer.rb +++ b/lib/liquid/tokenizer.rb @@ -81,7 +81,6 @@ module Liquid def next_variable_token start = @ss.pos @ss.pos += 2 - found_variable_end = false # it is possible to see a {% before a }} so we need to check for that byte_a = @ss.peek_byte @@ -92,8 +91,7 @@ module Liquid if byte_a == CLOSE_CURLEY && byte_b == CLOSE_CURLEY @ss.pos += 1 - found_variable_end = true - break + return @ss.string.byteslice(start, @ss.pos - start) elsif byte_a == OPEN_CURLEY && byte_b == PERCENTAGE return next_tag_token(start) end @@ -102,9 +100,7 @@ module Liquid @ss.pos += 1 end - return "{{" unless found_variable_end - - @ss.string.byteslice(start, @ss.pos - start) + return "{{" end def next_tag_token(start = nil)