From 1229bb27e108bf56d1f31f235a3833af177f01b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 29 Jul 2021 20:21:47 +0800 Subject: stack --- script/parser/guide.lua | 40 +++++++++++++++++++++++----------------- test.lua | 2 +- 2 files changed, 24 insertions(+), 18 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 diff --git a/test.lua b/test.lua index b83f1056..d9f8b957 100644 --- a/test.lua +++ b/test.lua @@ -91,7 +91,7 @@ local function main() --config.Lua.intelliSense.searchDepth = 5 --loadDocMetas() - test 'full' + --test 'full' require 'bee.platform'.OS = 'Windows' testAll() -- cgit v1.2.3