From 1376bba0f9cfc3e8f06130c3bb4f86589b0dc32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 21 Dec 2018 17:26:36 +0800 Subject: =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E4=BB=A5=E5=9C=A8=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E5=86=85=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/matcher/signature.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'server/src') diff --git a/server/src/matcher/signature.lua b/server/src/matcher/signature.lua index 7b51d5e6..96694047 100644 --- a/server/src/matcher/signature.lua +++ b/server/src/matcher/signature.lua @@ -10,18 +10,21 @@ end local function findArgCount(args, pos) for i, arg in ipairs(args) do if isContainPos(arg, pos) then - return i + return i, arg end end - return #args + 1 + return #args + 1, nil end --- 找出范围包含pos的,且有dirty标记的call -local function findDirtyCall(vm, pos) +-- 找出范围包含pos的call +local function findCall(vm, pos) local results = {} for _, call in ipairs(vm.results.calls) do if isContainPos(call.args, pos) then - local n = findArgCount(call.args, pos) + local n, arg = findArgCount(call.args, pos) + if arg and arg.type == 'string' then + return nil + end results[#results+1] = { func = call.func, var = vm.results.sources[call.lastObj], @@ -39,8 +42,8 @@ local function findDirtyCall(vm, pos) end return function (vm, pos) - local calls = findDirtyCall(vm, pos) - if #calls == 0 then + local calls = findCall(vm, pos) + if not calls or #calls == 0 then return nil end -- cgit v1.2.3