Skip to content

Commit 0caed1c

Browse files
authored
Fix #3631 (#3636)
Fixes #3631 by replacing the local TickQuota value with the global e2_tickquota
1 parent 85697a3 commit 0caed1c

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

lua/entities/gmod_wire_expression2/base/compiler.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,8 @@ local Token, TokenVariant = E2Lib.Tokenizer.Token, E2Lib.Tokenizer.Variant
1010
local Node, NodeVariant = E2Lib.Parser.Node, E2Lib.Parser.Variant
1111
local Operator = E2Lib.Operator
1212
local newE2Table = E2Lib.newE2Table
13-
1413
local pairs, ipairs = pairs, ipairs
1514

16-
local TickQuota = GetConVar("wire_expression2_quotatick"):GetInt()
17-
18-
cvars.RemoveChangeCallback("wire_expression2_quotatick", "compiler_quota_check")
19-
cvars.AddChangeCallback("wire_expression2_quotatick", function(_, old, new)
20-
TickQuota = tonumber(new)
21-
end, "compiler_quota_check")
22-
2315
---@class ScopeData
2416
---@field dead "ret"|true?
2517
---@field loop boolean?
@@ -265,7 +257,7 @@ local CompileVisitors = {
265257
if self.scope:ResolveData("loop") or self.scope:ResolveData("switch_case") then -- Inside loop or switch case, check if continued or broken
266258
return function(state) ---@param state RuntimeContext
267259
state.prf = state.prf + cost
268-
if state.prf > TickQuota then error("perf", 0) end
260+
if state.prf > e2_tickquota then error("perf", 0) end
269261

270262
for i = 1, nstmts do
271263
state.trace = traces[i]
@@ -276,7 +268,7 @@ local CompileVisitors = {
276268
elseif self.scope:ResolveData("function") then -- If inside a function, check if returned.
277269
return function(state) ---@param state RuntimeContext
278270
state.prf = state.prf + cost
279-
if state.prf > TickQuota then error("perf", 0) end
271+
if state.prf > e2_tickquota then error("perf", 0) end
280272

281273
for i = 1, nstmts do
282274
state.trace = traces[i]
@@ -287,7 +279,7 @@ local CompileVisitors = {
287279
else -- Most optimized case, not inside a function or loop.
288280
return function(state) ---@param state RuntimeContext
289281
state.prf = state.prf + cost
290-
if state.prf > TickQuota then error("perf", 0) end
282+
if state.prf > e2_tickquota then error("perf", 0) end
291283

292284
for i = 1, nstmts do
293285
state.trace = traces[i]

0 commit comments

Comments
 (0)