mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
more micro optimization
This commit is contained in:
@@ -81,7 +81,6 @@ module Liquid
|
|||||||
def next_variable_token
|
def next_variable_token
|
||||||
start = @ss.pos
|
start = @ss.pos
|
||||||
@ss.pos += 2
|
@ss.pos += 2
|
||||||
found_variable_end = false
|
|
||||||
|
|
||||||
# it is possible to see a {% before a }} so we need to check for that
|
# it is possible to see a {% before a }} so we need to check for that
|
||||||
byte_a = @ss.peek_byte
|
byte_a = @ss.peek_byte
|
||||||
@@ -92,8 +91,7 @@ module Liquid
|
|||||||
|
|
||||||
if byte_a == CLOSE_CURLEY && byte_b == CLOSE_CURLEY
|
if byte_a == CLOSE_CURLEY && byte_b == CLOSE_CURLEY
|
||||||
@ss.pos += 1
|
@ss.pos += 1
|
||||||
found_variable_end = true
|
return @ss.string.byteslice(start, @ss.pos - start)
|
||||||
break
|
|
||||||
elsif byte_a == OPEN_CURLEY && byte_b == PERCENTAGE
|
elsif byte_a == OPEN_CURLEY && byte_b == PERCENTAGE
|
||||||
return next_tag_token(start)
|
return next_tag_token(start)
|
||||||
end
|
end
|
||||||
@@ -102,9 +100,7 @@ module Liquid
|
|||||||
@ss.pos += 1
|
@ss.pos += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return "{{" unless found_variable_end
|
return "{{"
|
||||||
|
|
||||||
@ss.string.byteslice(start, @ss.pos - start)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_tag_token(start = nil)
|
def next_tag_token(start = nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user