diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:43:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:43:01 +0800 |
commit | d5ecec7f362db69879e5097e41bd334d76260783 (patch) | |
tree | 1b14ddf979adfb684a49d7db9d640b35d224c338 /script-beta/vm | |
parent | e98483d89ac38463cf5b717a3b19861baf8f3e94 (diff) | |
download | lua-language-server-d5ecec7f362db69879e5097e41bd334d76260783.zip |
整理代码
Diffstat (limited to 'script-beta/vm')
-rw-r--r-- | script-beta/vm/eachDef.lua | 12 | ||||
-rw-r--r-- | script-beta/vm/eachField.lua | 8 | ||||
-rw-r--r-- | script-beta/vm/eachRef.lua | 8 |
3 files changed, 14 insertions, 14 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 46d1887e..5d1aa566 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -4,7 +4,7 @@ local files = require 'files' local util = require 'utility' local await = require 'await' -local function eachDef(source, simple) +local function eachDef(source, deep) local results = {} local lock = vm.lock('eachDef', source) if not lock then @@ -14,7 +14,7 @@ local function eachDef(source, simple) await.delay() local clock = os.clock() - local myResults, count = guide.requestDefinition(source, vm.interface, simple) + local myResults, count = guide.requestDefinition(source, vm.interface, deep) if DEVELOP and os.clock() - clock > 0.1 then log.warn('requestDefinition', count, os.clock() - clock, guide.getUri(source), util.dump(source, { deep = 1 })) end @@ -30,15 +30,15 @@ function vm.getDefs(source, deep) local name = guide.getKeyName(source) local cache = vm.getCache('eachDefOfGlobal')[name] or vm.getCache('eachDef')[source] - or eachDef(source, deep) + or eachDef(source, 'deep') vm.getCache('eachDefOfGlobal')[name] = cache return cache - elseif not deep then - return eachDef(source, deep) else local cache = vm.getCache('eachDef')[source] or eachDef(source, deep) - vm.getCache('eachDef')[source] = cache + if deep then + vm.getCache('eachDef')[source] = cache + end return cache end end diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua index b644cbd9..90892f03 100644 --- a/script-beta/vm/eachField.lua +++ b/script-beta/vm/eachField.lua @@ -51,15 +51,15 @@ function vm.getFields(source, deep) local name = guide.getKeyName(source) local cache = vm.getCache('eachFieldOfGlobal')[name] or vm.getCache('eachField')[source] - or eachField(source, deep) + or eachField(source, 'deep') vm.getCache('eachFieldOfGlobal')[name] = cache return cache - elseif not deep then - return eachField(source, deep) else local cache = vm.getCache('eachField')[source] or eachField(source, deep) - vm.getCache('eachField')[source] = cache + if deep then + vm.getCache('eachField')[source] = cache + end return cache end end diff --git a/script-beta/vm/eachRef.lua b/script-beta/vm/eachRef.lua index 8df45c67..ea46c9ee 100644 --- a/script-beta/vm/eachRef.lua +++ b/script-beta/vm/eachRef.lua @@ -29,15 +29,15 @@ function vm.getRefs(source, deep) local name = guide.getKeyName(source) local cache = vm.getCache('eachRefOfGlobal')[name] or vm.getCache('eachRef')[source] - or getRefs(source, deep) + or getRefs(source, 'deep') vm.getCache('eachRefOfGlobal')[name] = cache return cache - elseif not deep then - return getRefs(source, deep) else local cache = vm.getCache('eachRef')[source] or getRefs(source, deep) - vm.getCache('eachRef')[source] = cache + if deep then + vm.getCache('eachRef')[source] = cache + end return cache end end |