diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-12 20:58:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-12 20:58:33 +0800 |
commit | 49b0244734a579036c1d3f318ce435a94974c038 (patch) | |
tree | 936e78c91cc824cb6fc00e4b694f96dcd13295db /script/parser | |
parent | 813da76cc7f899d7a0eca5afb0f224cd64eaaab0 (diff) | |
download | lua-language-server-49b0244734a579036c1d3f318ce435a94974c038.zip |
resolve pcall
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/guide.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 048a15bb..a838a42e 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -687,4 +687,50 @@ function m.lineData(lines, row) return lines[row] end +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' then + return true + end + if tp == 'call' then + local special = m.getSpecial(source.node) + if special == 'rawset' then + return true + end + end + return false +end + +function m.isGet(source) + local tp = source.type + if tp == 'getglobal' + or tp == 'getlocal' + or tp == 'getfield' + or tp == 'getmethod' + or tp == 'getindex' then + return true + end + if tp == 'call' then + local special = m.getSpecial(source.node) + if special == 'rawget' then + return true + end + end + return false +end + +function m.getSpecial(source) + if not source then + return nil + end + return source.special +end + return m |