diff options
Diffstat (limited to 'server/src/matcher')
-rw-r--r-- | server/src/matcher/diagnostics.lua | 7 | ||||
-rw-r--r-- | server/src/matcher/vm.lua | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/server/src/matcher/diagnostics.lua b/server/src/matcher/diagnostics.lua index bb9367fc..28a18013 100644 --- a/server/src/matcher/diagnostics.lua +++ b/server/src/matcher/diagnostics.lua @@ -115,11 +115,14 @@ end local function searchNewLineCall(results, lines, callback) for _, call in ipairs(results.calls) do - if not call.lastobj.start then + if not call.nextObj then + goto NEXT_CALL + end + if not call.lastObj.start then goto NEXT_CALL end local callline = lines:rowcol(call.call.start) - local lastline = lines:rowcol(call.lastobj.start) + local lastline = lines:rowcol(call.lastObj.finish) if callline > lastline then callback(call.call.start, call.call.finish) end diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 3f1e7d2a..16034eaf 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -585,6 +585,11 @@ function mt:unpackList(list) res[1] = value end end + for _, v in ipairs(res) do + if v.type == 'list' then + error('Unpack list') + end + end return res end @@ -600,6 +605,7 @@ function mt:getSimple(simple, mode) parentName = '?' end local object + local lastField = field for i = 2, #simple do local obj = simple[i] local tp = obj.type @@ -616,7 +622,8 @@ function mt:getSimple(simple, mode) end self.results.calls[#self.results.calls+1] = { call = obj, - lastobj = simple[i-1], + lastObj = simple[i-1], + nextObj = simple[i+1], } parentName = parentName .. '(...)' elseif obj.index then @@ -628,8 +635,9 @@ function mt:getSimple(simple, mode) self:addInfo(field, 'get', obj) end end + field.parent = lastField + lastField = field obj.object = object - obj.parentName = parentName if obj.type == 'string' then parentName = ('%s[%q]'):format(parentName, index) @@ -645,6 +653,8 @@ function mt:getSimple(simple, mode) if mode == 'value' or i < #simple then self:addInfo(field, 'get', obj) end + field.parent = lastField + lastField = field obj.object = object obj.parentName = parentName parentName = parentName .. '.' .. field.key |