summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-29 20:21:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-29 20:21:47 +0800
commit1229bb27e108bf56d1f31f235a3833af177f01b7 (patch)
treea00cc03ba092287dd45e60cb63892a34acc9bacb /script/parser
parent2dc07de0711da81a55adc7245da03c99b56519ed (diff)
downloadlua-language-server-1229bb27e108bf56d1f31f235a3833af177f01b7.zip
stack
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua40
1 files changed, 23 insertions, 17 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 998163aa..be763aa7 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -822,20 +822,23 @@ function m.lineData(lines, row)
return lines[row]
end
+local isSetMap = {
+ ['setglobal'] = true,
+ ['local'] = true,
+ ['setlocal'] = true,
+ ['setfield'] = true,
+ ['setmethod'] = true,
+ ['setindex'] = true,
+ ['tablefield'] = true,
+ ['tableindex'] = true,
+ ['tableexp'] = true,
+ ['doc.field.name'] = true,
+ ['doc.field'] = true,
+ ['doc.type.field'] = true,
+}
function m.isSet(source)
local tp = source.type
- if tp == 'setglobal'
- or tp == 'local'
- or tp == 'setlocal'
- or tp == 'setfield'
- or tp == 'setmethod'
- or tp == 'setindex'
- or tp == 'tablefield'
- or tp == 'tableindex'
- or tp == 'tableexp'
- or tp == 'doc.field.name'
- or tp == 'doc.field'
- or tp == 'doc.type.field' then
+ if isSetMap[tp] then
return true
end
if tp == 'call' then
@@ -847,13 +850,16 @@ function m.isSet(source)
return false
end
+local isGetMap = {
+ ['getglobal'] = true,
+ ['getlocal'] = true,
+ ['getfield'] = true,
+ ['getmethod'] = true,
+ ['getindex'] = true,
+}
function m.isGet(source)
local tp = source.type
- if tp == 'getglobal'
- or tp == 'getlocal'
- or tp == 'getfield'
- or tp == 'getmethod'
- or tp == 'getindex' then
+ if isGetMap[tp] then
return true
end
if tp == 'call' then