mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
more micro optimization
This commit is contained in:
@@ -75,7 +75,6 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
@ss.pos -= 2
|
@ss.pos -= 2
|
||||||
|
|
||||||
@ss.string.byteslice(start, @ss.pos - start)
|
@ss.string.byteslice(start, @ss.pos - start)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -85,16 +84,21 @@ module Liquid
|
|||||||
found_variable_end = false
|
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
|
||||||
|
@ss.pos += 1
|
||||||
|
|
||||||
until @ss.eos?
|
until @ss.eos?
|
||||||
case @ss.peek(2)
|
byte_b = @ss.peek_byte
|
||||||
when "}}"
|
|
||||||
@ss.pos += 2
|
if byte_a == CLOSE_CURLEY && byte_b == CLOSE_CURLEY
|
||||||
|
@ss.pos += 1
|
||||||
found_variable_end = true
|
found_variable_end = true
|
||||||
break
|
break
|
||||||
when "{%"
|
elsif byte_a == OPEN_CURLEY && byte_b == PERCENTAGE
|
||||||
return next_tag_token(start)
|
return next_tag_token(start)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
byte_a = byte_b
|
||||||
@ss.pos += 1
|
@ss.pos += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user