diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-28 17:51:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-28 17:51:56 +0800 |
commit | 8c7f8eb408a3864f00be331bde09ce6986827881 (patch) | |
tree | 91ec405b237457030eba77e240f336998fb4efaa /server/src/core/document_symbol.lua | |
parent | 777eecd9e4dfd17395590d72f8312b53831c0e67 (diff) | |
download | lua-language-server-8c7f8eb408a3864f00be331bde09ce6986827881.zip |
先平铺吧
Diffstat (limited to 'server/src/core/document_symbol.lua')
-rw-r--r-- | server/src/core/document_symbol.lua | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua index b0802b9b..8e6fd01c 100644 --- a/server/src/core/document_symbol.lua +++ b/server/src/core/document_symbol.lua @@ -30,7 +30,7 @@ local SymbolKind = { TypeParameter = 26, } -local function buildFunc(vm, func, nextFunction, nextFinish) +local function buildFunc(vm, func) local source = func.source local declarat = func.declarat local name @@ -76,28 +76,9 @@ local function buildFunc(vm, func, nextFunction, nextFinish) end return function (vm) - local i = 0 - local function nextFunction() - i = i + 1 - local func = vm.results.funcs[i] - return func - end - - local function nextFinish() - local func = vm.results.funcs[i+1] - if not func then - return 0 - end - return func.source.finish - end - local symbols = {} - while true do - local func = nextFunction() - if not func then - break - end - symbols[#symbols+1] = buildFunc(vm, func, nextFunction, nextFinish) + for _, func in ipairs(vm.results.funcs) do + symbols[#symbols+1] = buildFunc(vm, func) end return symbols |