We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
contains_call()
1 parent 7897788 commit b39bbd0Copy full SHA for b39bbd0
src/luacheck/stages/resolve_locals.lua
@@ -79,18 +79,26 @@ local function in_scope(var, index)
79
end
80
81
local function contains_call(node)
82
+ if node._contains_call ~= nil then
83
+ -- return cached result
84
+ return node._contains_call
85
+ end
86
+
87
if node.tag == "Call" or node.tag == "Invoke" then
88
+ node._contains_call = true
89
return true
90
91
92
if node.tag ~= "Function" then
93
for _, sub_node in ipairs(node) do
94
if type(sub_node) == 'table' and contains_call(sub_node) then
95
96
97
98
99
100
101
+ node._contains_call = false
102
return false
103
104
0 commit comments