diff options
author | Lei Zhu <uhziel@gmail.com> | 2021-01-05 16:50:34 +0800 |
---|---|---|
committer | Lei Zhu <uhziel@gmail.com> | 2021-01-05 16:50:34 +0800 |
commit | 39bbefd8b4c98be50955b2484af1a6b6f9541f54 (patch) | |
tree | 8de7b76600c0dee0a9a0030cbf5e2da49fa725e1 /script/parser | |
parent | c57556e25cb02e01011272c305854d0f1c106e1c (diff) | |
download | lua-language-server-39bbefd8b4c98be50955b2484af1a6b6f9541f54.zip |
原生API不要去判名字,用 special 字段来判断,这样支持 local ipairs = ipairs 的情况
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/compile.lua | 2 | ||||
-rw-r--r-- | script/parser/guide.lua | 4 |
2 files changed, 4 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 7a5be591..56f6ac38 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2206,8 +2206,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 |