summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/parser/compile.lua2
-rw-r--r--script/parser/guide.lua4
-rw-r--r--test/definition/luadoc.lua1
3 files changed, 5 insertions, 2 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua
index d4129ab4..f9992047 100644
--- a/script/parser/compile.lua
+++ b/script/parser/compile.lua
@@ -12,6 +12,8 @@ local specials = {
['loadfile'] = true,
['pcall'] = true,
['xpcall'] = true,
+ ['pairs'] = true,
+ ['ipairs'] = true,
}
_ENV = nil
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index fed3577f..5264a2b6 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -2238,8 +2238,8 @@ local function getTableAndIndexIfIsForPairsKeyOrValue(ref)
end
local pairsCallObj = rootCallObj.node
- if not pairsCallObj.node or pairsCallObj.node.type ~= 'getglobal'
- or (pairsCallObj.node[1] ~= 'pairs' and pairsCallObj.node[1] ~= 'ipairs') then
+ if not pairsCallObj.node
+ or (pairsCallObj.node.special ~= 'pairs' and pairsCallObj.node.special ~= 'ipairs') then
return
end
diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua
index 210f5a26..3c0c764b 100644
--- a/test/definition/luadoc.lua
+++ b/test/definition/luadoc.lua
@@ -300,6 +300,7 @@ function Foo:<!bar1!>() end
---@type table<number, Foo>
local v1
+local ipairs = ipairs
for i, v in ipairs(v1) do
print(v.<?bar1?>)
end