summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-12 14:54:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-12 14:54:40 +0800
commitcbff022761f244cbb8940f812ede207c44ab2614 (patch)
treecb4b04f568cb71136103103d2b348d77a1729542 /script
parent3b97d7d4d54755517db0fd776c006bbb37313967 (diff)
downloadlua-language-server-cbff022761f244cbb8940f812ede207c44ab2614.zip
update generic
Diffstat (limited to 'script')
-rw-r--r--script/core/generic.lua5
-rw-r--r--script/core/linker.lua8
-rw-r--r--script/core/searcher.lua4
-rw-r--r--script/parser/ast.lua6
4 files changed, 12 insertions, 11 deletions
diff --git a/script/core/generic.lua b/script/core/generic.lua
index 9f203e69..53ced59c 100644
--- a/script/core/generic.lua
+++ b/script/core/generic.lua
@@ -157,7 +157,7 @@ local function buildValues(closure)
if doc.type == 'doc.param' then
local extends = doc.extends
local index = extends.paramIndex
- local param = params[index]
+ local param = params and params[index]
closure.params[index] = param and createValue(closure, extends, function (road, key, proto)
buildValue(road, key, proto, param, upvalues)
end) or extends
@@ -191,9 +191,6 @@ end
function m.createClosure(proto, call)
local protoFunction, parentClosure
if proto.type == 'function' then
- if not proto.args or #proto.args == 0 then
- return nil
- end
protoFunction = proto
elseif proto.type == 'generic.value' then
protoFunction = proto.proto
diff --git a/script/core/linker.lua b/script/core/linker.lua
index f2a9e572..622561db 100644
--- a/script/core/linker.lua
+++ b/script/core/linker.lua
@@ -117,12 +117,18 @@ local function getKey(source)
end
return source.start, nil
elseif source.type == 'doc.class.name'
- or source.type == 'doc.type.name'
or source.type == 'doc.alias.name'
or source.type == 'doc.extends.name'
or source.type == 'doc.see.name' then
local name = source[1]
return name, nil
+ elseif source.type == 'doc.type.name' then
+ if source.typeGeneric then
+ return source.start, nil
+ else
+ local name = source[1]
+ return name, nil
+ end
elseif source.type == 'doc.class'
or source.type == 'doc.type'
or source.type == 'doc.alias'
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 54d95859..fc1c08d1 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -174,7 +174,6 @@ function m.searchRefsByID(status, uri, expect, mode)
status.id = expect
local mark = status.mark
- local queueIndex = 0
local callStack = {}
@@ -186,11 +185,10 @@ function m.searchRefsByID(status, uri, expect, mode)
else
fieldLen = 0
end
- if mark[id] and mark[id] <= fieldLen then
+ if mark[id] and ((mark[id] < fieldLen) or fieldLen == 0) then
return
end
mark[id] = fieldLen
- queueIndex = queueIndex + 1
searchStep(id, field)
end
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 47093f0e..b2a9fa37 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -1461,9 +1461,9 @@ local Defs = {
if func then
local call = createCall(exp, func.finish + 1, exp.finish)
if #exp == 0 then
- exp[1] = getSelect(func, 1)
- exp[2] = getSelect(func, 2)
- exp[3] = getSelect(func, 3)
+ exp[1] = getSelect(func, 2)
+ exp[2] = getSelect(func, 3)
+ exp[3] = getSelect(func, 4)
end
call.node = func
call.start = inA