diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 11:46:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 11:46:05 +0800 |
commit | 3715635806ae4680a81746d46e3714a4d06b0f5d (patch) | |
tree | e155634e77cfcf32bb1a56ec11b8f86a14581bc8 /script/vm | |
parent | d559737fc37d2ab99a030dbe33d3190315391859 (diff) | |
download | lua-language-server-3715635806ae4680a81746d46e3714a4d06b0f5d.zip |
performance optimization
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/getClass.lua | 2 | ||||
-rw-r--r-- | script/vm/getMeta.lua | 4 | ||||
-rw-r--r-- | script/vm/guideInterface.lua | 8 |
3 files changed, 9 insertions, 5 deletions
diff --git a/script/vm/getClass.lua b/script/vm/getClass.lua index 1b77171b..c4e39523 100644 --- a/script/vm/getClass.lua +++ b/script/vm/getClass.lua @@ -27,7 +27,7 @@ local function getClass(source, classes, depth, deep) classes[#classes+1] = value[1] end else - for _, src in ipairs(vm.getFields(value)) do + for _, src in ipairs(vm.getDefFields(value)) do local key = vm.getKeyName(src) if not key then goto CONTINUE diff --git a/script/vm/getMeta.lua b/script/vm/getMeta.lua index b6265dcc..44d1874a 100644 --- a/script/vm/getMeta.lua +++ b/script/vm/getMeta.lua @@ -35,10 +35,10 @@ end function vm.eachMetaValue(source, callback) vm.eachMeta(source, function (mt) - for _, src in ipairs(vm.getFields(mt)) do + for _, src in ipairs(vm.getDefFields(mt)) do if vm.getKeyName(src) == '__index' then if src.value then - for _, valueSrc in ipairs(vm.getFields(src.value)) do + for _, valueSrc in ipairs(vm.getDefFields(src.value)) do callback(valueSrc) end end diff --git a/script/vm/guideInterface.lua b/script/vm/guideInterface.lua index b464ab98..323ef76e 100644 --- a/script/vm/guideInterface.lua +++ b/script/vm/guideInterface.lua @@ -78,9 +78,13 @@ function vm.interface.call(func, args, index) end end -function vm.interface.global(name) +function vm.interface.global(name, onlyDef) await.delay() - return vm.getGlobals(name) + if onlyDef then + return vm.getGlobalSets(name) + else + return vm.getGlobals(name) + end end function vm.interface.docType(name) |