diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-05-30 15:54:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-05-30 15:54:13 +0800 |
commit | 245c99bb1ca69dab538c3106b640a478f963d6ed (patch) | |
tree | ac94261beaf5ca526316fbe9223057c1da518fe5 /script-beta/vm | |
parent | fee8530cfa83c11e76def4f2ab891a9a7cb25c81 (diff) | |
download | lua-language-server-245c99bb1ca69dab538c3106b640a478f963d6ed.zip |
整理代码
Diffstat (limited to 'script-beta/vm')
-rw-r--r-- | script-beta/vm/eachDef.lua | 4 | ||||
-rw-r--r-- | script-beta/vm/getValue.lua | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index e30e3b51..2f29aa83 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -3,10 +3,14 @@ local guide = require 'parser.guide' local function eachDef(source) local lib = vm.getLibrary(source) + local value = guide.getObjectValue(source) local results = guide.requestDefinition(source) if lib then results[#results+1] = lib end + if value then + results[#results+1] = value + end return results end diff --git a/script-beta/vm/getValue.lua b/script-beta/vm/getValue.lua index d091bf32..b0361df7 100644 --- a/script-beta/vm/getValue.lua +++ b/script-beta/vm/getValue.lua @@ -2,6 +2,7 @@ local vm = require 'vm.vm' local util = require 'utility' local guide = require 'parser.guide' local library = require 'library' +local select = select local typeSort = { ['boolean'] = 1, @@ -952,12 +953,16 @@ function vm.viewType(values) end function vm.mergeViews(...) + local max = select('#', ...) local views = {} - for _, view in ipairs {...} do - for tp in view:gmatch '[^|]+' do - if not views[tp] and tp ~= 'any' then - views[tp] = true - views[#views+1] = tp + for i = 1, max do + local view = select(i, ...) + if view then + for tp in view:gmatch '[^|]+' do + if not views[tp] and tp ~= 'any' then + views[tp] = true + views[#views+1] = tp + end end end end |