diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-29 16:11:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-29 16:11:55 +0800 |
commit | 01fae72b1a503857a5735f76988ab257f298b256 (patch) | |
tree | a75f616f8261c6b49e709a96ac0e8c7c24a03919 /server/src/matcher/env.lua | |
parent | 5db32ce42188ec69858c34715a8e4f5778ddc9df (diff) | |
download | lua-language-server-01fae72b1a503857a5735f76988ab257f298b256.zip |
更新
Diffstat (limited to 'server/src/matcher/env.lua')
-rw-r--r-- | server/src/matcher/env.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/src/matcher/env.lua b/server/src/matcher/env.lua index 3a7388d1..13787fc0 100644 --- a/server/src/matcher/env.lua +++ b/server/src/matcher/env.lua @@ -1,3 +1,8 @@ +local setmetatable = setmetatable +local pairs = pairs +local type = type +local table_sort = table.sort + return function (root) local env = {root} local is_table = {} @@ -10,11 +15,11 @@ return function (root) root._cut = {} local mt = { _env = env } - function mt:add() - table.insert(env, { _next = env[#env], _cut = {} }) + function mt:push() + env[#env+1] = { _next = env[#env], _cut = {} } end - function mt:remove() - table.remove(env) + function mt:pop() + env[#env] = nil end function mt:cut(key) env[#env]._cut[key] = true @@ -122,7 +127,7 @@ return function (root) break end end - table.sort(keys) + table_sort(keys) local i = 0 return function () i = i + 1 |