summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-14 22:26:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-14 22:26:04 +0800
commit21ee5e8a7393e936f2c36d5628e2a307750f4ff5 (patch)
tree91af80df299e238839a5c6e1cc290ffb9966c087 /script/vm
parentccce6e0b430a29cd58bfcffc07fd17ebaba3ddc4 (diff)
downloadlua-language-server-21ee5e8a7393e936f2c36d5628e2a307750f4ff5.zip
cleanup
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua47
1 files changed, 33 insertions, 14 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 06f09ebb..a17cc5b2 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -297,18 +297,19 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
end
mark[name] = true
searchedFields = searchedFields or {}
- for _, set in ipairs(class:getSets(suri)) do
- if set.type == 'doc.class' then
- -- check ---@field
- local hasFounded = {}
- local function copyToSearched()
- for fieldKey in pairs(hasFounded) do
- searchedFields[fieldKey] = true
- hasFounded[fieldKey] = nil
- end
- end
+ local hasFounded = {}
+ local function copyToSearched()
+ for fieldKey in pairs(hasFounded) do
+ searchedFields[fieldKey] = true
+ hasFounded[fieldKey] = nil
+ end
+ end
+ local sets = class:getSets(suri)
+ for _, set in ipairs(sets) do
+ if set.type == 'doc.class' then
+ -- check ---@field
for _, field in ipairs(set.fields) do
local fieldKey = guide.getKeyName(field)
if fieldKey then
@@ -366,7 +367,12 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
end
::CONTINUE::
end
- copyToSearched()
+ end
+ end
+ copyToSearched()
+
+ for _, set in ipairs(sets) do
+ if set.type == 'doc.class' then
-- check local field and global field
if not searchedFields[key] and set.bindSource then
local src = set.bindSource
@@ -403,7 +409,15 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
end)
end
end
- copyToSearched()
+ end
+ end
+ end
+ copyToSearched()
+
+ for _, set in ipairs(sets) do
+ if set.type == 'doc.class' then
+ if not searchedFields[key] and set.bindSource then
+ local src = set.bindSource
searchFieldSwitch(src.type, suri, src, key, ref, function (field)
local fieldKey = guide.getKeyName(field)
if fieldKey and not searchedFields[fieldKey] then
@@ -421,8 +435,13 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
end
end
end)
- copyToSearched()
end
+ end
+ end
+ copyToSearched()
+
+ for _, set in ipairs(sets) do
+ if set.type == 'doc.class' then
-- look into extends(if field not found)
if not searchedFields[key] and set.extends then
for _, extend in ipairs(set.extends) do
@@ -433,10 +452,10 @@ function vm.getClassFields(suri, object, key, ref, pushResult)
end
end
end
- copyToSearched()
end
end
end
+ copyToSearched()
end
local function searchGlobal(class)