summaryrefslogtreecommitdiff
path: root/script-beta/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-26 14:35:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-26 14:35:01 +0800
commitb899ea541c6186ed9c4a3f2cefbb502eb22b083a (patch)
tree03c77b3caa0031f159a6cef4e8fd06041d575efb /script-beta/core
parentc268c130f7eaa493296357b1bd0ce14eb67626a2 (diff)
downloadlua-language-server-b899ea541c6186ed9c4a3f2cefbb502eb22b083a.zip
修正报错
Diffstat (limited to 'script-beta/core')
-rw-r--r--script-beta/core/document-symbol.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/script-beta/core/document-symbol.lua b/script-beta/core/document-symbol.lua
index d7eb59ea..56d0dfbc 100644
--- a/script-beta/core/document-symbol.lua
+++ b/script-beta/core/document-symbol.lua
@@ -7,12 +7,16 @@ local util = require 'utility'
local function buildName(source, text)
if source.type == 'setmethod'
or source.type == 'getmethod' then
- return text:sub(source.start, source.method.finish)
+ if source.method then
+ return text:sub(source.start, source.method.finish)
+ end
end
if source.type == 'setfield'
or source.type == 'tablefield'
or source.type == 'getfield' then
- return text:sub(source.start, source.field.finish)
+ if source.field then
+ return text:sub(source.start, source.field.finish)
+ end
end
return text:sub(source.start, source.finish)
end