diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 11:27:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 11:27:01 +0800 |
commit | 0415404ae424d9fbf08d10e291d5a73c2ed821e6 (patch) | |
tree | 3566c0f894603db92f1294be75c96626f1f85c9c /server/src/vm/library.lua | |
parent | 02c05d770711b0d1edc3cb42a74fe6d03214903c (diff) | |
download | lua-language-server-0415404ae424d9fbf08d10e291d5a73c2ed821e6.zip |
内存测试
Diffstat (limited to 'server/src/vm/library.lua')
-rw-r--r-- | server/src/vm/library.lua | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/server/src/vm/library.lua b/server/src/vm/library.lua index 60f56368..54dca81f 100644 --- a/server/src/vm/library.lua +++ b/server/src/vm/library.lua @@ -1,6 +1,6 @@ local sourceMgr = require 'vm.source' -local createValue +local valueMgr local createFunction local CHILD_CACHE = {} @@ -13,16 +13,16 @@ function buildLibValue(lib) if VALUE_CACHE[lib] then return VALUE_CACHE[lib] end - if not createValue then - createValue = require 'vm.value' + if not valueMgr then + valueMgr = require 'vm.value' createFunction = require 'vm.function' end local tp = lib.type local value if tp == 'table' then - value = createValue('table', sourceMgr.dummy()) + value = valueMgr.create('table', sourceMgr.dummy()) elseif tp == 'function' then - value = createValue('function', sourceMgr.dummy()) + value = valueMgr.create('function', sourceMgr.dummy()) local func = createFunction() value:setFunction(func) if lib.args then @@ -40,17 +40,17 @@ function buildLibValue(lib) end end elseif tp == 'string' then - value = createValue('string', sourceMgr.dummy()) + value = valueMgr.create('string', sourceMgr.dummy()) elseif tp == 'boolean' then - value = createValue('boolean', sourceMgr.dummy()) + value = valueMgr.create('boolean', sourceMgr.dummy()) elseif tp == 'number' then - value = createValue('number', sourceMgr.dummy()) + value = valueMgr.create('number', sourceMgr.dummy()) elseif tp == 'integer' then - value = createValue('integer', sourceMgr.dummy()) + value = valueMgr.create('integer', sourceMgr.dummy()) elseif tp == 'nil' then - value = createValue('nil', sourceMgr.dummy()) + value = valueMgr.create('nil', sourceMgr.dummy()) else - value = createValue(tp or 'any', sourceMgr.dummy()) + value = valueMgr.create(tp or 'any', sourceMgr.dummy()) end value:setLib(lib) VALUE_CACHE[lib] = value @@ -67,8 +67,8 @@ function buildLibValue(lib) end function buildLibChild(lib) - if not createValue then - createValue = require 'vm.value' + if not valueMgr then + valueMgr = require 'vm.value' createFunction = require 'vm.function' end if CHILD_CACHE[lib] then |