summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-05 20:08:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-05 20:08:49 +0800
commitfdb6fcbab260ffc829550ac59c952791d0ed18b6 (patch)
tree6e8395bd8f892008f51c4d401f4034b7f6711d05 /server/src
parent68e33bf512598a92e8b4432f32603c89b5cacf3a (diff)
downloadlua-language-server-fdb6fcbab260ffc829550ac59c952791d0ed18b6.zip
修正emmy function type会提示局部变量未使用的bug
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/diagnostics.lua3
-rw-r--r--server/src/vm/emmy.lua3
-rw-r--r--server/src/vm/function.lua1
3 files changed, 6 insertions, 1 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua
index badf3b00..8eab5960 100644
--- a/server/src/core/diagnostics.lua
+++ b/server/src/core/diagnostics.lua
@@ -14,6 +14,9 @@ function mt:searchUnusedLocals(callback)
if not loc then
return
end
+ if loc:get 'emmy arg' then
+ return
+ end
local name = loc:getName()
if name == '_' or name == '_ENV' or name == '' then
return
diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua
index 45fb13f9..b193a7de 100644
--- a/server/src/vm/emmy.lua
+++ b/server/src/vm/emmy.lua
@@ -312,7 +312,8 @@ function mt:buildEmmyFunctionType(source)
local value = self:createValue(paramType:getType(), typeSource)
value:setEmmy(paramType)
self:instantSource(nameSource)
- func:addArg(nameSource[1], nameSource, value)
+ local arg = func:addArg(nameSource[1], nameSource, value)
+ arg:set('emmy arg', true)
end
end
local returns = source.returns
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua
index b6772cd1..1ba01363 100644
--- a/server/src/vm/function.lua
+++ b/server/src/vm/function.lua
@@ -391,6 +391,7 @@ function mt:addArg(name, source, value, close)
loc:close(close)
self:saveUpvalue(name, loc)
self.args[#self.args+1] = loc
+ return loc
end
function mt:createArg(vm, arg, close)