summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-09 05:28:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-09 05:28:59 +0800
commitdf58ac0f9dec8fb58950a66ffb10dbe9f5eb4f4b (patch)
tree98b3fb58cd7ebb86d78e5a470b421d62563c8858 /script/vm
parentaf4e3094bd5592d2e9d6a769ef1d7a1660b3e48e (diff)
downloadlua-language-server-df58ac0f9dec8fb58950a66ffb10dbe9f5eb4f4b.zip
update
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua12
-rw-r--r--script/vm/def.lua3
-rw-r--r--script/vm/global-manager.lua2
-rw-r--r--script/vm/infer.lua2
-rw-r--r--script/vm/ref.lua3
5 files changed, 12 insertions, 10 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 87306550..0becbbf0 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -150,7 +150,7 @@ function m.getClassFields(suri, node, key, pushResult)
return
end
mark[name] = true
- for _, set in ipairs(class:getSets()) do
+ for _, set in ipairs(class:getSets(suri)) do
if set.type == 'doc.class' then
-- check ---@field
local hasFounded
@@ -1408,9 +1408,9 @@ local function compileByNode(source)
end
---@param source vm.node
-local function compileByGlobal(source)
+local function compileByGlobal(uri, source)
+ uri = uri or guide.getUri(source)
if source.type == 'global' then
- local uri = guide.getUri(source)
nodeMgr.setNode(source, source)
if source.cate == 'variable' then
local hasMarkDoc
@@ -1453,7 +1453,7 @@ local function compileByGlobal(source)
return
end
if source._globalNode then
- nodeMgr.setNode(source, m.compileNode(source._globalNode))
+ nodeMgr.setNode(source, m.compileNode(source._globalNode, uri))
return
end
end
@@ -1478,7 +1478,7 @@ end
---@param source parser.object
---@return vm.node
-function m.compileNode(source)
+function m.compileNode(source, uri)
if not source then
return false
end
@@ -1493,7 +1493,7 @@ function m.compileNode(source)
end
nodeMgr.nodeCache[source] = false
- compileByGlobal(source)
+ compileByGlobal(uri, source)
compileByNode(source)
--localMgr.subscribeLocal(source, source._node)
diff --git a/script/vm/def.lua b/script/vm/def.lua
index 887da8e9..81d23854 100644
--- a/script/vm/def.lua
+++ b/script/vm/def.lua
@@ -200,9 +200,10 @@ local function searchByNode(source, pushResult)
if not node then
return
end
+ local suri = guide.getUri(source)
for n in nodeMgr.eachNode(node) do
if n.type == 'global' then
- for _, set in ipairs(n:getSets()) do
+ for _, set in ipairs(n:getSets(suri)) do
pushResult(set)
end
else
diff --git a/script/vm/global-manager.lua b/script/vm/global-manager.lua
index 317b128b..bb4498ff 100644
--- a/script/vm/global-manager.lua
+++ b/script/vm/global-manager.lua
@@ -269,7 +269,7 @@ function m.getGlobalSets(suri, cate)
local globals = m.getGlobals(cate)
local result = {}
for _, global in ipairs(globals) do
- local sets = global:getSets()
+ local sets = global:getSets(suri)
for _, set in ipairs(sets) do
result[#result+1] = set
end
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index 1ccc54aa..04fd01ca 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -201,7 +201,7 @@ function mt:_eraseAlias()
local expandAlias = config.get(self.uri, 'Lua.hover.expandAlias')
for n in nodeMgr.eachNode(self.node) do
if n.type == 'global' and n.cate == 'type' then
- for _, set in ipairs(n:getSets()) do
+ for _, set in ipairs(n:getSets(self.uri)) do
if set.type == 'doc.alias' then
if expandAlias then
self.views[n.name] = nil
diff --git a/script/vm/ref.lua b/script/vm/ref.lua
index e1bdf81d..472b3b49 100644
--- a/script/vm/ref.lua
+++ b/script/vm/ref.lua
@@ -259,9 +259,10 @@ local function searchByNode(source, pushResult)
if not node then
return
end
+ local uri = guide.getUri(source)
for n in nodeMgr.eachNode(node) do
if n.type == 'global' then
- for _, get in ipairs(n:getGets()) do
+ for _, get in ipairs(n:getGets(uri)) do
pushResult(get)
end
end