diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-29 11:08:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-29 11:08:28 +0800 |
commit | 5cd2e0110dfe2d1bc8c141af74baa53dab448c66 (patch) | |
tree | ecccd44e7d90167f701f89dc3f2ade465785b8bf /script-beta | |
parent | 0b1bbe021805f7ac9bf616ac78f7dc316af05f81 (diff) | |
download | lua-language-server-5cd2e0110dfe2d1bc8c141af74baa53dab448c66.zip |
修正搜索全局变量的bug
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/parser/guide.lua | 8 | ||||
-rw-r--r-- | script-beta/vm/getGlobals.lua | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 31e2b9d8..0b1f1a85 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1766,6 +1766,14 @@ function m.searchSameFields(status, simple, mode) if first.tag == '_ENV' then -- 检查全局变量的分支情况,需要业务层传入 interface.global m.checkSameSimpleInGlobal(status, simple[1], 1, queue) + if first.ref then + for _, ref in ipairs(first.ref) do + queue[#queue+1] = { + obj = ref, + start = 1, + } + end + end else simple.global = nil tableInsert(simple, 1, 'l|_ENV') diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua index 2e3cd019..c5d6dc21 100644 --- a/script-beta/vm/getGlobals.lua +++ b/script-beta/vm/getGlobals.lua @@ -32,7 +32,7 @@ end local function getGlobals(name) local results = {} - for uri in files:eachFile() do + for uri in files.eachFile() do local cache = files.getCache(uri) cache.globals = cache.globals or getGlobalsOfFile(uri) if name == '*' then |