From 8c7f8eb408a3864f00be331bde09ce6986827881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 28 Dec 2018 17:51:56 +0800 Subject: =?UTF-8?q?=E5=85=88=E5=B9=B3=E9=93=BA=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/document_symbol.lua | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'server/src/core/document_symbol.lua') 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 -- cgit v1.2.3