diff options
Diffstat (limited to 'server/src/matcher/references.lua')
-rw-r--r-- | server/src/matcher/references.lua | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/server/src/matcher/references.lua b/server/src/matcher/references.lua index f5b72c55..a241025c 100644 --- a/server/src/matcher/references.lua +++ b/server/src/matcher/references.lua @@ -1,46 +1,16 @@ local findResult = require 'matcher.find_result' -local function tryMeta(var) - local keys = {} - repeat - if var.childs.meta then - local metavar = var.childs.meta - for i = #keys, 1, -1 do - local key = keys[i] - metavar = metavar.childs[key] - if not metavar then - return nil - end - end - return metavar - end - keys[#keys+1] = var.key - var = var.parent - until not var - return nil -end - local function parseResult(result, declarat) local positions = {} local tp = result.type - if tp == 'var' then - local var = result.var - for _, info in ipairs(var) do + if tp == 'local' then + for _, info in ipairs(result.object) do if declarat or info.type == 'get' then positions[#positions+1] = {info.source.start, info.source.finish} end end - local metavar = tryMeta(var) - if metavar then - for _, info in ipairs(metavar) do - if declarat or info.type == 'get' then - positions[#positions+1] = {info.source.start, info.source.finish} - end - end - end - elseif tp == 'dots' then - local dots = result.dots - for _, info in ipairs(dots) do + elseif tp == 'field' then + for _, info in ipairs(result.object) do if declarat or info.type == 'get' then positions[#positions+1] = {info.source.start, info.source.finish} end @@ -58,8 +28,8 @@ local function parseResult(result, declarat) return positions end -return function (results, pos, declarat) - local result = findResult(results, pos) +return function (vm, pos, declarat) + local result = findResult(vm.results, pos) if not result then return nil end |