summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-29 15:32:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-29 15:32:51 +0800
commit72fccb749b959881011e0ab0830c11917bfc3c55 (patch)
tree624e03d817d0ac87057185f663368682146f1a7d /script
parentc18f88dded6e14a0c931467dc856e5a1b2170076 (diff)
downloadlua-language-server-72fccb749b959881011e0ab0830c11917bfc3c55.zip
resolve #1244 `call.return` check `as`
Diffstat (limited to 'script')
-rw-r--r--script/vm/compiler.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 265d8b8b..549ace71 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -11,6 +11,7 @@ local vm = require 'vm.vm'
---@field _node vm.node
---@field _globalBase table
---@field cindex integer
+---@field func parser.object
-- 该函数有副作用,会给source绑定node!
local function bindDocs(source)
@@ -557,11 +558,15 @@ local function getReturn(func, index, args)
func._callReturns = {}
end
if not func._callReturns[index] then
+ local call = func.parent
func._callReturns[index] = {
type = 'call.return',
- parent = func,
+ parent = call,
+ func = func,
cindex = index,
args = args,
+ start = call.start,
+ finish = call.finish,
}
end
return vm.compileNode(func._callReturns[index])
@@ -1531,7 +1536,10 @@ local compilerSwitch = util.switch()
: case 'call.return'
---@param source parser.object
: call(function (source)
- local func = source.parent
+ if bindAs(source) then
+ return
+ end
+ local func = source.func
local args = source.args
local index = source.cindex
if func.special == 'setmetatable' then