summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-22 03:56:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-22 03:56:24 +0800
commitcdb6c06ca2983f1caf1a0964997c8c44ea784b27 (patch)
treeb5356d6ad6e5c076d2e63140e9f72469987f5f49 /script
parentb26b7f7029d895c672a0a4d057d00b36355acaa7 (diff)
downloadlua-language-server-cdb6c06ca2983f1caf1a0964997c8c44ea784b27.zip
check nil
Diffstat (limited to 'script')
-rw-r--r--script/parser/luadoc.lua2
-rw-r--r--script/vm/compiler.lua4
2 files changed, 4 insertions, 2 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index f44b789b..e69e98d3 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -126,7 +126,7 @@ Symbol <- ({} {
---@field literal boolean
---@field signs parser.object[]
---@field originalComment parser.object
----@field as parser.object
+---@field as? parser.object
local function trim(str)
return str:match '^%s*(%S+)%s*$'
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 4395eea4..7bb9ba1b 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -497,7 +497,9 @@ local function bindAs(source)
end
for _, doc in ipairs(docs) do
if doc.type == 'doc.as' and doc.originalComment.start == source.finish + 2 then
- vm.setNode(source, vm.compileNode(doc.as), true)
+ if doc.as then
+ vm.setNode(source, vm.compileNode(doc.as), true)
+ end
return true
end
end