summaryrefslogtreecommitdiff
path: root/script-beta/core
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/core')
-rw-r--r--script-beta/core/completion.lua2
-rw-r--r--script-beta/core/diagnostics/redundant-parameter.lua4
-rw-r--r--script-beta/core/hover/table.lua6
-rw-r--r--script-beta/core/reference.lua9
-rw-r--r--script-beta/core/semantic-tokens.lua4
-rw-r--r--script-beta/core/signature.lua2
6 files changed, 14 insertions, 13 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index 5a18ccaf..6939d240 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -196,7 +196,7 @@ local function getSnip(source)
if context <= 0 then
return nil
end
- local defs = vm.getRefs(source, 'simple')
+ local defs = vm.getRefs(source)
for _, def in ipairs(defs) do
if def ~= source and def.type == 'function' then
local uri = guide.getUri(def)
diff --git a/script-beta/core/diagnostics/redundant-parameter.lua b/script-beta/core/diagnostics/redundant-parameter.lua
index a03a408f..074e7f7c 100644
--- a/script-beta/core/diagnostics/redundant-parameter.lua
+++ b/script-beta/core/diagnostics/redundant-parameter.lua
@@ -6,7 +6,7 @@ local define = require 'proto.define'
local await = require 'await'
local function countLibraryArgs(source)
- local lib = vm.getLibrary(source, 'simple')
+ local lib = vm.getLibrary(source)
if not lib then
return nil
end
@@ -63,7 +63,7 @@ return function (uri, callback)
local func = source.node
local funcArgs
- local defs = vm.getDefs(func, 'simple')
+ local defs = vm.getDefs(func)
for _, def in ipairs(defs) do
if def.type == 'function' then
local args = countFuncArgs(def)
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua
index 812a69be..314d0b42 100644
--- a/script-beta/core/hover/table.lua
+++ b/script-beta/core/hover/table.lua
@@ -49,9 +49,9 @@ local function getField(src)
end
end
end
- local tp = vm.getInferType(src, 'simple')
- local class = vm.getClass(src, 'simple')
- local literal = vm.getInferLiteral(src, 'simple')
+ local tp = vm.getInferType(src)
+ local class = vm.getClass(src)
+ local literal = vm.getInferLiteral(src)
if type(literal) == 'string' and #literal >= 50 then
literal = literal:sub(1, 47) .. '...'
end
diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua
index 13d698a2..0e3268f5 100644
--- a/script-beta/core/reference.lua
+++ b/script-beta/core/reference.lua
@@ -71,10 +71,10 @@ return function (uri, offset)
local results = {}
vm.setSearchLevel(10)
- vm.eachRef(source, function (src)
+ for _, src in ipairs(vm.getRefs(source, 'deep')) do
local root = guide.getRoot(src)
if not root then
- return
+ goto CONTINUE
end
if src.type == 'setfield'
or src.type == 'getfield'
@@ -88,13 +88,14 @@ return function (uri, offset)
or src.type == 'setmethod' then
src = src.method
elseif src.type == 'table' and src.parent.type ~= 'return' then
- return
+ goto CONTINUE
end
results[#results+1] = {
target = src,
uri = files.getOriginUri(root.uri),
}
- end)
+ ::CONTINUE::
+ end
if #results == 0 then
return nil
diff --git a/script-beta/core/semantic-tokens.lua b/script-beta/core/semantic-tokens.lua
index 222f54b6..fa037610 100644
--- a/script-beta/core/semantic-tokens.lua
+++ b/script-beta/core/semantic-tokens.lua
@@ -15,7 +15,7 @@ Care['setglobal'] = function (source, results)
}
end
Care['getglobal'] = function (source, results)
- local lib = vm.getLibrary(source, 'simple')
+ local lib = vm.getLibrary(source)
if lib then
if source[1] == '_G' then
return
@@ -67,7 +67,7 @@ Care['getlocal'] = function (source, results)
end
-- 3. 不是函数的局部变量
local hasFunc
- for _, def in ipairs(vm.getDefs(loc, 'simple')) do
+ for _, def in ipairs(vm.getDefs(loc)) do
if def.type == 'function'
or (def.type == 'library' and def.value.type == 'function') then
hasFunc = true
diff --git a/script-beta/core/signature.lua b/script-beta/core/signature.lua
index be39f6c9..ba21ae50 100644
--- a/script-beta/core/signature.lua
+++ b/script-beta/core/signature.lua
@@ -79,7 +79,7 @@ local function makeSignatures(call, pos)
index = 1
end
local signs = {}
- local defs = vm.getDefs(node, 'simple')
+ local defs = vm.getDefs(node)
for _, src in ipairs(defs) do
if src.type == 'function' then
signs[#signs+1] = makeOneSignature(src, oop, index)