Skip to content

Commit 29ae1f7

Browse files
committed
perf: avoid recreate RELATION module on every call
1 parent 7dbb5c5 commit 29ae1f7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/liquid.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ local special_chars = {
130130
[36] = true, -- byte for char $
131131
}
132132

133+
local RELATION = {
134+
[EQ] = true,
135+
[NE] = true,
136+
[GE] = true,
137+
[GT] = true,
138+
[LE] = true,
139+
[LT] = true,
140+
[CONTAINS] = true
141+
}
142+
133143
local function sanitize_replace(str)
134144
local tbl = {stringbyte(str, 1, #str)}
135145
local result = {}
@@ -1442,7 +1452,6 @@ function Parser:relexper( ... )
14421452
| LT exper
14431453
| CONTAINS exper}
14441454
]]
1445-
local RELATION = {[EQ] = true, [NE] = true, [GE] = true, [GT] = true, [LE] = true, [LT] = true, [CONTAINS] = true}
14461455
local pos_info = {}
14471456
local left = self:exper()
14481457
local token_type = self.current_token.token_type

0 commit comments

Comments
 (0)